Changeset bad4a05 in mainline


Ignore:
Timestamp:
2018-01-11T04:12:06Z (6 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0892663a
Parents:
a6c4597
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-11 01:31:42)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-11 04:12:06)
Message:

usbhost: made device_remove and endpoint_unregister noexcept

Location:
uspace
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ehci/ehci_bus.c

    ra6c4597 rbad4a05  
    113113}
    114114
    115 static int ehci_unregister_ep(endpoint_t *ep)
     115static void ehci_unregister_ep(endpoint_t *ep)
    116116{
    117117        bus_t *bus_base = endpoint_get_bus(ep);
     
    120120        assert(ep);
    121121
    122         const int err = usb2_bus_ops.endpoint_unregister(ep);
    123         if (err)
    124                 return err;
    125 
     122        usb2_bus_ops.endpoint_unregister(ep);
    126123        hc_dequeue_endpoint(bus->hc, ep);
    127         return EOK;
    128124}
    129125
  • uspace/drv/bus/usb/ohci/ohci_bus.c

    ra6c4597 rbad4a05  
    118118}
    119119
    120 static int ohci_unregister_ep(endpoint_t *ep)
     120static void ohci_unregister_ep(endpoint_t *ep)
    121121{
    122122        ohci_bus_t *bus = (ohci_bus_t *) endpoint_get_bus(ep);
    123123        assert(ep);
    124124
    125         const int err = usb2_bus_ops.endpoint_unregister(ep);
    126         if (err)
    127                 return err;
    128 
     125        usb2_bus_ops.endpoint_unregister(ep);
    129126        hc_dequeue_endpoint(bus->hc, ep);
    130         return EOK;
    131127}
    132128
  • uspace/drv/bus/usb/xhci/bus.c

    ra6c4597 rbad4a05  
    193193}
    194194
    195 static int endpoint_unregister(endpoint_t *);
    196 
    197195/**
    198196 * Remove device from XHCI bus. Transition it to the offline state, abort all
     
    205203 * @return Error code.
    206204 */
    207 static int device_remove(device_t *dev)
     205static void device_remove(device_t *dev)
    208206{
    209207        int err;
     
    249247                        continue;
    250248
    251                 if ((err = endpoint_unregister(dev->endpoints[i]))) {
    252                         usb_log_warning("Failed to unregister endpoint " XHCI_EP_FMT ": %s",
    253                             XHCI_EP_ARGS(*xhci_device_get_endpoint(xhci_dev, i)), str_error(err));
    254                 }
     249                bus_endpoint_remove(dev->endpoints[i]);
    255250        }
    256251
     
    258253        /* XXX: Not a good idea, this method should not destroy devices. */
    259254        hcd_ddf_fun_destroy(dev);
    260 
    261         return EOK;
    262255}
    263256
     
    415408 * Bus callback.
    416409 */
    417 static int endpoint_unregister(endpoint_t *ep_base)
     410static void endpoint_unregister(endpoint_t *ep_base)
    418411{
    419412        int err;
     
    433426                    " the slot has already been disabled.", XHCI_EP_ARGS(*ep));
    434427        }
    435 
    436         return EOK;
    437428}
    438429
  • uspace/drv/bus/usb/xhci/rh.c

    ra6c4597 rbad4a05  
    188188{
    189189        assert(rh);
    190         int err;
    191190
    192191        /* Find XHCI device by the port. */
     
    207206
    208207        /* Remove device from XHCI bus. */
    209         if ((err = bus_device_remove(&dev->base))) {
    210                 usb_log_warning("Failed to remove device " XHCI_DEV_FMT " from XHCI bus: %s",
    211                     XHCI_DEV_ARGS(*dev), str_error(err));
    212         }
     208        bus_device_remove(&dev->base);
    213209
    214210        return EOK;
  • uspace/lib/usbhost/include/usb/host/bus.h

    ra6c4597 rbad4a05  
    103103        /* Operations on device */
    104104        int (*device_enumerate)(device_t *);
    105         int (*device_remove)(device_t *);
     105        void (*device_remove)(device_t *);
    106106        int (*device_online)(device_t *);                       /**< Optional */
    107107        int (*device_offline)(device_t *);                      /**< Optional */
     
    110110        /* Operations on endpoint */
    111111        int (*endpoint_register)(endpoint_t *);
    112         int (*endpoint_unregister)(endpoint_t *);
     112        void (*endpoint_unregister)(endpoint_t *);
    113113        void (*endpoint_destroy)(endpoint_t *);                 /**< Optional */
    114114        void (*endpoint_toggle_reset)(endpoint_t *);            /**< Optional */
     
    117117
    118118        /* Operations on batch */
     119        int (*batch_schedule)(usb_transfer_batch_t *);
    119120        void (*batch_destroy)(usb_transfer_batch_t *);          /**< Optional */
    120         int (*batch_schedule)(usb_transfer_batch_t *);
    121121};
    122122
     
    149149
    150150int bus_device_enumerate(device_t *);
    151 int bus_device_remove(device_t *);
     151void bus_device_remove(device_t *);
    152152
    153153int bus_device_online(device_t *);
  • uspace/lib/usbhost/src/bus.c

    ra6c4597 rbad4a05  
    112112 * Invoke the device_remove bus operation.
    113113 */
    114 int bus_device_remove(device_t *dev)
     114void bus_device_remove(device_t *dev)
    115115{
    116116        assert(dev);
    117117
    118118        const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_remove);
    119         if (!ops)
    120                 return ENOTSUP;
     119        assert(ops);
    121120
    122121        return ops->device_remove(dev);
     
    266265
    267266        fibril_mutex_lock(&device->guard);
    268         const int r = ops->endpoint_unregister(ep);
    269         if (!r)
    270                 device->endpoints[ep->endpoint] = NULL;
     267        ops->endpoint_unregister(ep);
     268        device->endpoints[ep->endpoint] = NULL;
    271269        fibril_mutex_unlock(&device->guard);
    272 
    273         if (r)
    274                 return r;
    275270
    276271        /* Abort a transfer batch, if there was any */
  • uspace/lib/usbhost/src/usb2_bus.c

    ra6c4597 rbad4a05  
    250250 * Release bandwidth reserved by the given endpoint.
    251251 */
    252 static int usb2_bus_unregister_ep(endpoint_t *ep)
     252static void usb2_bus_unregister_ep(endpoint_t *ep)
    253253{
    254254        usb2_bus_t *bus = bus_to_usb2_bus(ep->device->bus);
     
    256256
    257257        bus->free_bw += ep->bandwidth;
    258 
    259         return EOK;
    260258}
    261259
Note: See TracChangeset for help on using the changeset viewer.