Changeset df40775 in mainline for uspace/lib/usb/src/host/bandwidth.c


Ignore:
Timestamp:
2011-04-04T19:38:11Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6bf9bc4
Parents:
3094804b (diff), 65369473 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Bandwidth allocator fixes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/src/host/bandwidth.c

    r3094804b rdf40775  
    6666        const size_t bytes =
    6767            keys < MAX_KEYS ? keys * sizeof(unsigned long) : sizeof(transfer_t);
    68         return bcmp(key, &status->transfer, bytes);
     68        return bcmp(key, &status->transfer, bytes) == 0;
    6969}
    7070/*----------------------------------------------------------------------------*/
     
    221221/*----------------------------------------------------------------------------*/
    222222int bandwidth_use(bandwidth_t *instance, usb_address_t address,
    223     usb_endpoint_t endpoint, usb_direction_t direction)
     223    usb_endpoint_t endpoint, usb_direction_t direction, size_t bw)
    224224{
    225225        assert(instance);
     
    237237                    hash_table_get_instance(item, transfer_status_t, link);
    238238                assert(status);
    239                 if (status->used) {
    240                         ret = EINPROGRESS;
     239                if (status->required >= bw) {
     240                        if (status->used) {
     241                                ret = EINPROGRESS;
     242                        }
     243                        status->used = true;
     244                } else {
     245                        ret = ENOSPC;
    241246                }
    242                 status->used = true;
    243247        } else {
    244248                ret = EINVAL;
Note: See TracChangeset for help on using the changeset viewer.