Changeset d369b3b in mainline for uspace/drv/bus/usb/ehci/ehci_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:
296d22fc
Parents:
b357377
git-author:
Ondřej Hlavatý <aearsis@…> (2018-01-25 01:52:13)
git-committer:
Ondřej Hlavatý <aearsis@…> (2018-01-25 02:05:57)
Message:

usb2_bus: no longer be a bus

As the number of implemented functions got to 3, it's not so beneficial
to inherit usb2 bus to get the functionality. Overall, four trampolines
needed to be added, which is an acceptable number.

Now, the usb2_bus has become a usb2_bus_helper, to be used as
a companion to the common bus.

This is mostly a preparation to remove the runtime binding of the bus
methods.

File:
1 edited

Legend:

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

    rb357377 rd369b3b  
    5757}
    5858
     59static int ehci_device_enumerate(device_t *dev)
     60{
     61        ehci_bus_t *bus = (ehci_bus_t *) dev->bus;
     62        return usb2_bus_device_enumerate(&bus->helper, dev);
     63}
    5964
    6065/** Creates new hcd endpoint representation.
     
    101106        ehci_endpoint_t *ehci_ep = ehci_endpoint_get(ep);
    102107
    103         const int err = usb2_bus_ops.endpoint_register(ep);
     108        const int err = usb2_bus_endpoint_register(&bus->helper, ep);
    104109        if (err)
    105110                return err;
     
    119124        assert(ep);
    120125
    121         usb2_bus_ops.endpoint_unregister(ep);
     126        usb2_bus_endpoint_unregister(&bus->helper, ep);
    122127        hc_dequeue_endpoint(hc, ep);
    123128        /*
     
    154159
    155160static const bus_ops_t ehci_bus_ops = {
    156         .parent = &usb2_bus_ops,
    157 
    158161        .interrupt = ehci_hc_interrupt,
    159162        .status = ehci_hc_status,
     163
     164        .device_enumerate = ehci_device_enumerate,
    160165
    161166        .endpoint_destroy = ehci_endpoint_destroy,
     
    174179        assert(bus);
    175180
    176         usb2_bus_t *usb2_bus = (usb2_bus_t *) bus;
    177181        bus_t *bus_base = (bus_t *) bus;
     182        bus_init(bus_base, sizeof(device_t));
     183        bus_base->ops = &ehci_bus_ops;
    178184
    179         usb2_bus_init(usb2_bus, &bandwidth_accounting_usb2);
    180         bus_base->ops = &ehci_bus_ops;
     185        usb2_bus_helper_init(&bus->helper, &bandwidth_accounting_usb2);
    181186
    182187        bus->hc = hc;
Note: See TracChangeset for help on using the changeset viewer.