Changeset 45bf63c in mainline for uspace/drv/bus/usb/ohci/hc.c


Ignore:
Timestamp:
2011-10-30T15:35:36Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
20a3465, 3ce78580
Parents:
1737bfb (diff), e978ada (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from USB branch.

Cleanup libusbhost interfaces.
Fix few possible memory corruption/crashes and memory leaks.
Add device_remove hooks for usbflbk, usbhid.

File:
1 edited

Legend:

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

    r1737bfb r45bf63c  
    142142if (ret != EOK) { \
    143143        usb_log_error(message); \
    144         usb_endpoint_manager_unregister_ep( \
    145             &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH);\
     144        usb_endpoint_manager_remove_ep( \
     145            &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH, \
     146            NULL, NULL);\
    146147        usb_device_manager_release( \
    147148            &instance->generic.dev_manager, hub_address); \
     
    150151        int ret = usb_endpoint_manager_add_ep(
    151152            &instance->generic.ep_manager, hub_address, 0, USB_DIRECTION_BOTH,
    152             USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64, 0);
     153            USB_TRANSFER_CONTROL, USB_SPEED_FULL, 64, 0, NULL, NULL);
    153154        CHECK_RET_UNREG_RETURN(ret,
    154155            "Failed to register root hub control endpoint: %s.\n",
     
    192193        list_initialize(&instance->pending_batches);
    193194
    194         ret = hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11,
     195        hcd_init(&instance->generic, BANDWIDTH_AVAILABLE_USB11,
    195196            bandwidth_count_usb11);
    196         CHECK_RET_RETURN(ret, "Failed to initialize generic driver: %s.\n",
    197             str_error(ret));
    198197        instance->generic.private_data = instance;
    199198        instance->generic.schedule = hc_schedule;
    200199        instance->generic.ep_add_hook = ohci_endpoint_init;
     200        instance->generic.ep_remove_hook = ohci_endpoint_fini;
    201201
    202202        ret = hc_init_memory(instance);
     
    221221}
    222222/*----------------------------------------------------------------------------*/
    223 void hc_enqueue_endpoint(hc_t *instance, endpoint_t *ep)
    224 {
     223void hc_enqueue_endpoint(hc_t *instance, const endpoint_t *ep)
     224{
     225        assert(instance);
     226        assert(ep);
     227
    225228        endpoint_list_t *list = &instance->lists[ep->transfer_type];
    226229        ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
     230        assert(list);
     231        assert(ohci_ep);
     232
    227233        /* Enqueue ep */
    228234        switch (ep->transfer_type) {
     
    247253}
    248254/*----------------------------------------------------------------------------*/
    249 void hc_dequeue_endpoint(hc_t *instance, endpoint_t *ep)
    250 {
     255void hc_dequeue_endpoint(hc_t *instance, const endpoint_t *ep)
     256{
     257        assert(instance);
     258        assert(ep);
     259
    251260        /* Dequeue ep */
    252261        endpoint_list_t *list = &instance->lists[ep->transfer_type];
    253262        ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
     263
     264        assert(list);
     265        assert(ohci_ep);
    254266        switch (ep->transfer_type) {
    255267        case USB_TRANSFER_CONTROL:
Note: See TracChangeset for help on using the changeset viewer.