Changeset 6b6fc232 in mainline


Ignore:
Timestamp:
2011-11-04T16:06:25Z (12 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bbd09694
Parents:
46f2808
Message:

libusbhost,iface: Remove all registered endpoints on address release.

Warn if there are any endpoints that would be let behind.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbhost/src/iface.c

    r46f2808 r6b6fc232  
    8989}
    9090/*----------------------------------------------------------------------------*/
     91static int register_helper(endpoint_t *ep, void *arg)
     92{
     93        hcd_t *hcd = arg;
     94        assert(ep);
     95        assert(hcd);
     96        if (hcd->ep_add_hook)
     97                return hcd->ep_add_hook(hcd, ep);
     98        return EOK;
     99}
     100/*----------------------------------------------------------------------------*/
     101static void unregister_helper(endpoint_t *ep, void *arg)
     102{
     103        hcd_t *hcd = arg;
     104        assert(ep);
     105        assert(hcd);
     106        if (hcd->ep_remove_hook)
     107                hcd->ep_remove_hook(hcd, ep);
     108}
     109/*----------------------------------------------------------------------------*/
     110static void unregister_helper_warn(endpoint_t *ep, void *arg)
     111{
     112        hcd_t *hcd = arg;
     113        assert(ep);
     114        assert(hcd);
     115        usb_log_warning("Endpoint %d:%d %s was left behind, removing.\n",
     116            ep->address, ep->endpoint, usb_str_direction(ep->direction));
     117        if (hcd->ep_remove_hook)
     118                hcd->ep_remove_hook(hcd, ep);
     119}
     120/*----------------------------------------------------------------------------*/
    91121/** Request address interface function
    92122 *
     
    159189        usb_log_debug("Address release %d.\n", address);
    160190        usb_device_manager_release_address(&hcd->dev_manager, address);
     191        usb_endpoint_manager_remove_address(&hcd->ep_manager, address,
     192            unregister_helper_warn, hcd);
    161193        return EOK;
    162 }
    163 /*----------------------------------------------------------------------------*/
    164 static int register_helper(endpoint_t *ep, void *arg)
    165 {
    166         hcd_t *hcd = arg;
    167         assert(ep);
    168         assert(hcd);
    169         if (hcd->ep_add_hook)
    170                 return hcd->ep_add_hook(hcd, ep);
    171         return EOK;
    172 }
    173 /*----------------------------------------------------------------------------*/
    174 static void unregister_helper(endpoint_t *ep, void *arg)
    175 {
    176         hcd_t *hcd = arg;
    177         assert(ep);
    178         assert(hcd);
    179         if (hcd->ep_remove_hook)
    180                 hcd->ep_remove_hook(hcd, ep);
    181194}
    182195/*----------------------------------------------------------------------------*/
Note: See TracChangeset for help on using the changeset viewer.