Changeset b357377 in mainline for uspace/lib/usbhost/src/usb2_bus.c


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

usbhost: make bandwidth accounting a usb2_bus-thing

File:
1 edited

Legend:

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

    r5f0b366 rb357377  
    219219        assert(ep);
    220220
    221         bus_t *bus = ep->device->bus;
    222         const bus_ops_t *ops = BUS_OPS_LOOKUP(bus->ops, endpoint_count_bw);
    223         if (!ops)
    224                 return 0;
    225 
    226         return ops->endpoint_count_bw(ep, ep->max_transfer_size);
     221        usb2_bus_t *bus = bus_to_usb2_bus(ep->device->bus);
     222
     223        return bus->bw_accounting->count_bw(ep);
    227224}
    228225
     
    269266 * @param available_bandwidth Size of the bandwidth pool.
    270267 */
    271 void usb2_bus_init(usb2_bus_t *bus, size_t available_bandwidth)
     268void usb2_bus_init(usb2_bus_t *bus, const bandwidth_accounting_t *bw_accounting)
    272269{
    273270        assert(bus);
     271        assert(bw_accounting);
    274272
    275273        bus_init(&bus->base, sizeof(device_t));
    276274        bus->base.ops = &usb2_bus_ops;
    277275
    278         bus->free_bw = available_bandwidth;
     276        bus->bw_accounting = bw_accounting;
     277        bus->free_bw = bw_accounting->available_bandwidth;
    279278
    280279        /*
Note: See TracChangeset for help on using the changeset viewer.