Ignore:
Timestamp:
2011-03-21T23:42:08Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
11dd29b, 62f4212
Parents:
31b568e (diff), 87644b4 (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:

Fixes selecting a new USB address when max address has been reached.

Whitespace and code-style fixes, renames

File:
1 edited

Legend:

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

    r31b568e rb01995b  
    214214        fibril_mutex_lock(&instance->guard);
    215215
    216         usb_address_t new_address = instance->last_address + 1;
    217         while (instance->devices[new_address].occupied) {
     216        usb_address_t new_address = instance->last_address;
     217        do {
     218                ++new_address;
     219                if (new_address > USB11_ADDRESS_MAX)
     220                        new_address = 1;
    218221                if (new_address == instance->last_address) {
    219222                        fibril_mutex_unlock(&instance->guard);
    220223                        return ENOSPC;
    221224                }
    222                 if (new_address == USB11_ADDRESS_MAX)
    223                         new_address = 1;
    224                 ++new_address;
    225         }
     225        } while (instance->devices[new_address].occupied);
    226226
    227227        assert(new_address != USB_ADDRESS_DEFAULT);
Note: See TracChangeset for help on using the changeset viewer.