Changeset 8ea7459 in mainline for uspace/drv/bus/usb/xhci/bus.c


Ignore:
Timestamp:
2017-10-21T12:17:09Z (7 years ago)
Author:
Petr Manek <petr.manek@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f270ecb
Parents:
d1d7a92
Message:

Refactored some parts of RH to HC. Also moved some bus ops around.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/xhci/bus.c

    rd1d7a92 r8ea7459  
    9494}
    9595
    96 static int enumerate_device(bus_t *bus, hcd_t *hcd, device_t *dev)
     96int xhci_bus_remove_device(xhci_bus_t *bus, xhci_hc_t *hc, device_t *dev)
     97{
     98        // TODO: Implement me!
     99        return ENOTSUP;
     100}
     101
     102/** Ops receive generic bus_t pointer. */
     103static inline xhci_bus_t *bus_to_xhci_bus(bus_t *bus_base)
     104{
     105        assert(bus_base);
     106        return (xhci_bus_t *) bus_base;
     107}
     108
     109static int enumerate_device(bus_t *bus_base, hcd_t *hcd, device_t *dev)
    97110{
    98111        xhci_hc_t *hc = hcd_get_driver_data(hcd);
    99112        assert(hc);
    100113
    101         return xhci_bus_enumerate_device((xhci_bus_t *) bus, hc, dev);
    102 }
    103 
    104 static int remove_device(bus_t *bus, hcd_t *hcd, device_t *dev)
    105 {
    106         // TODO: Implement me!
    107 
    108         return ENOTSUP;
    109 }
    110 
    111 /** Ops receive generic bus_t pointer. */
    112 static inline xhci_bus_t *bus_to_xhci_bus(bus_t *bus_base)
    113 {
    114         assert(bus_base);
    115         return (xhci_bus_t *) bus_base;
     114        xhci_bus_t *bus = bus_to_xhci_bus(bus_base);
     115        assert(bus);
     116
     117        return xhci_bus_enumerate_device(bus, hc, dev);
     118}
     119
     120static int remove_device(bus_t *bus_base, hcd_t *hcd, device_t *dev)
     121{
     122        xhci_hc_t *hc = hcd_get_driver_data(hcd);
     123        assert(hc);
     124
     125        xhci_bus_t *bus = bus_to_xhci_bus(bus_base);
     126        assert(bus);
     127
     128        return xhci_bus_remove_device(bus, hc, dev);
    116129}
    117130
     
    246259                return res;
    247260
    248         xhci_device_remove_endpoint(hashed_dev->device, xhci_endpoint_get(ep));
     261        res = xhci_device_remove_endpoint(hashed_dev->device, xhci_endpoint_get(ep));
     262        if (res != EOK)
     263                return res;
    249264
    250265        if (hashed_dev->device->active_endpoint_count == 0) {
Note: See TracChangeset for help on using the changeset viewer.