Changeset 32e093e in mainline


Ignore:
Timestamp:
2011-08-25T10:17:06Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b02308e
Parents:
1a02517
Message:

libusbhost: Add destructor for hcdata

Location:
uspace
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/hcd_endpoint.c

    r1a02517 r32e093e  
    8888        ed_init(hcd_ep->ed, ep);
    8989        ed_set_td(hcd_ep->ed, hcd_ep->td);
    90         endpoint_set_hc_data(ep, hcd_ep, hcd_ep_toggle_get, hcd_ep_toggle_set);
     90        endpoint_set_hc_data(
     91            ep, hcd_ep, NULL, hcd_ep_toggle_get, hcd_ep_toggle_set);
    9192
    9293        return hcd_ep;
  • uspace/lib/usbhost/include/usb/host/endpoint.h

    r1a02517 r32e093e  
    5656        struct {
    5757                void *data;
     58                void (*data_dtor)(void*);
    5859                int (*toggle_get)(void *);
    5960                void (*toggle_set)(void *, int);
     
    6869
    6970void endpoint_set_hc_data(endpoint_t *instance,
    70     void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int));
     71    void *data, void (*data_dtor)(void *),
     72    int (*toggle_get)(void *), void (*toggle_set)(void *, int));
    7173
    7274void endpoint_clear_hc_data(endpoint_t *instance);
  • uspace/lib/usbhost/src/endpoint.c

    r1a02517 r32e093e  
    5353                instance->toggle = 0;
    5454                instance->active = false;
     55                instance->hc_data.data = NULL;
     56                instance->hc_data.data_dtor = NULL;
     57                instance->hc_data.toggle_get = NULL;
     58                instance->hc_data.toggle_set = NULL;
    5559                fibril_mutex_initialize(&instance->guard);
    5660                fibril_condvar_initialize(&instance->avail);
     
    6468        assert(instance);
    6569        assert(!instance->active);
     70        if (instance->hc_data.data) {
     71                assert(instance->hc_data.data_dtor);
     72                instance->hc_data.data_dtor(instance->hc_data.data);
     73        }
    6674        free(instance);
    6775}
    6876/*----------------------------------------------------------------------------*/
    6977void endpoint_set_hc_data(endpoint_t *instance,
    70     void *data, int (*toggle_get)(void *), void (*toggle_set)(void *, int))
     78    void *data, void (*data_dtor)(void *),
     79    int (*toggle_get)(void *), void (*toggle_set)(void *, int))
    7180{
    7281        assert(instance);
    7382        instance->hc_data.data = data;
     83        instance->hc_data.data_dtor = data_dtor;
    7484        instance->hc_data.toggle_get = toggle_get;
    7585        instance->hc_data.toggle_set = toggle_set;
Note: See TracChangeset for help on using the changeset viewer.