Changeset d369b3b in mainline for uspace/drv/bus/usb/ohci


Ignore:
Timestamp:
2018-01-25T02:05:57Z (8 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.

Location:
uspace/drv/bus/usb/ohci
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/ohci/ohci_bus.c

    rb357377 rd369b3b  
    5757}
    5858
     59static int ohci_device_enumerate(device_t *dev)
     60{
     61        ohci_bus_t *bus = (ohci_bus_t *) dev->bus;
     62        return usb2_bus_device_enumerate(&bus->helper, dev);
     63}
     64
    5965/** Creates new hcd endpoint representation.
    6066 */
     
    109115        ohci_endpoint_t *ohci_ep = ohci_endpoint_get(ep);
    110116
    111         const int err = usb2_bus_ops.endpoint_register(ep);
     117        const int err = usb2_bus_endpoint_register(&bus->helper, ep);
    112118        if (err)
    113119                return err;
     
    126132        assert(ep);
    127133
    128         usb2_bus_ops.endpoint_unregister(ep);
     134        usb2_bus_endpoint_unregister(&bus->helper, ep);
    129135        hc_dequeue_endpoint(bus->hc, ep);
    130136
     
    162168
    163169static const bus_ops_t ohci_bus_ops = {
    164         .parent = &usb2_bus_ops,
    165 
    166170        .interrupt = ohci_hc_interrupt,
    167171        .status = ohci_hc_status,
     172
     173        .device_enumerate = ohci_device_enumerate,
    168174
    169175        .endpoint_destroy = ohci_endpoint_destroy,
     
    183189        assert(bus);
    184190
    185         usb2_bus_t *usb2_bus = (usb2_bus_t *) bus;
    186191        bus_t *bus_base = (bus_t *) bus;
    187 
    188         usb2_bus_init(usb2_bus, &bandwidth_accounting_usb11);
     192        bus_init(bus_base, sizeof(device_t));
    189193        bus_base->ops = &ohci_bus_ops;
     194
     195        usb2_bus_helper_init(&bus->helper, &bandwidth_accounting_usb11);
    190196
    191197        bus->hc = hc;
  • uspace/drv/bus/usb/ohci/ohci_bus.h

    rb357377 rd369b3b  
    6060
    6161typedef struct {
    62         usb2_bus_t base;
     62        bus_t base;
     63        usb2_bus_helper_t helper;
    6364        hc_t *hc;
    6465} ohci_bus_t;
Note: See TracChangeset for help on using the changeset viewer.