Changeset 296d22fc in mainline for uspace/lib/usbhost/src/bus.c


Ignore:
Timestamp:
2018-01-25T02:05:57Z (7 years ago)
Author:
Ondřej Hlavatý <aearsis@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
fa4b12d5
Parents:
d369b3b
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-25 02:03:48)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-25 02:05:57)
Message:

usbhub: revert the runtime binding of bus methods

It was just a dead end.

File:
1 edited

Legend:

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

    rd369b3b r296d22fc  
    129129        assert(dev);
    130130
    131         const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_enumerate);
    132         if (!ops)
     131        if (!dev->bus->ops->device_enumerate)
    133132                return ENOTSUP;
    134133
     
    138137        device_setup_tt(dev);
    139138
    140         const int r = ops->device_enumerate(dev);
     139        const int r = dev->bus->ops->device_enumerate(dev);
    141140        if (r)
    142141                return r;
     
    208207        assert(dev->fun != NULL);
    209208
    210         const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_gone);
    211         const bus_ops_t *ep_ops = BUS_OPS_LOOKUP(dev->bus->ops, endpoint_unregister);
     209        const bus_ops_t *ops = dev->bus->ops;
    212210
    213211        /* First, block new transfers and operations. */
     
    241239
    242240        /* Tell the HC to release its resources. */
    243         if (ops)
     241        if (ops->device_gone)
    244242                ops->device_gone(dev);
    245243
    246244        /* Check whether the driver didn't forgot EP0 */
    247245        if (dev->endpoints[0]) {
    248                 if (ep_ops)
    249                         ep_ops->endpoint_unregister(dev->endpoints[0]);
     246                if (ops->endpoint_unregister)
     247                        ops->endpoint_unregister(dev->endpoints[0]);
    250248                /* Release the EP0 bus reference */
    251249                endpoint_del_ref(dev->endpoints[0]);
     
    271269
    272270        /* First, tell the HC driver. */
    273         const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_online);
    274         if (ops && (rc = ops->device_online(dev))) {
     271        const bus_ops_t *ops = dev->bus->ops;
     272        if (ops->device_online && (rc = ops->device_online(dev))) {
    275273                usb_log_warning("Host controller failed to make device '%s' online: %s",
    276274                    ddf_fun_get_name(dev->fun), str_error(rc));
     
    329327
    330328        /* Tell also the HC driver. */
    331         const bus_ops_t *ops = BUS_OPS_LOOKUP(dev->bus->ops, device_offline);
    332         if (ops)
     329        const bus_ops_t *ops = dev->bus->ops;
     330        if (ops->device_offline)
    333331                ops->device_offline(dev);
    334332
     
    365363        bus_t *bus = device->bus;
    366364
    367         const bus_ops_t *register_ops = BUS_OPS_LOOKUP(bus->ops, endpoint_register);
    368         if (!register_ops)
     365        if (!bus->ops->endpoint_register)
    369366                return ENOTSUP;
    370367
    371         const bus_ops_t *create_ops = BUS_OPS_LOOKUP(bus->ops, endpoint_create);
    372368        endpoint_t *ep;
    373         if (create_ops) {
    374                 ep = create_ops->endpoint_create(device, desc);
     369        if (bus->ops->endpoint_create) {
     370                ep = bus->ops->endpoint_create(device, desc);
    375371                if (!ep)
    376372                        return ENOMEM;
     
    410406                err = EEXIST;
    411407        } else {
    412                 err = register_ops->endpoint_register(ep);
     408                err = bus->ops->endpoint_register(ep);
    413409                if (!err)
    414410                        device->endpoints[idx] = ep;
     
    480476        bus_t *bus = device->bus;
    481477
    482         const bus_ops_t *ops = BUS_OPS_LOOKUP(bus->ops, endpoint_unregister);
    483         if (!ops)
     478        if (!bus->ops->endpoint_unregister)
    484479                return ENOTSUP;
    485480
     
    496491
    497492        fibril_mutex_lock(&device->guard);
    498         ops->endpoint_unregister(ep);
     493        bus->ops->endpoint_unregister(ep);
    499494        device->endpoints[idx] = NULL;
    500495        fibril_mutex_unlock(&device->guard);
Note: See TracChangeset for help on using the changeset viewer.