Changeset c4e3b1f7 in mainline


Ignore:
Timestamp:
2011-04-12T11:06:07Z (14 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
910ca3f
Parents:
a81736d5
Message:

Unused code elimination

Location:
uspace/lib/usb
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usb/include/usb/host/device_keeper.h

    ra81736d5 rc4e3b1f7  
    5454        usb_speed_t speed;
    5555        bool occupied;
    56         link_t endpoints;
    57         uint16_t control_used;
    5856        devman_handle_t handle;
    5957};
     
    6563        struct usb_device_info devices[USB_ADDRESS_COUNT];
    6664        fibril_mutex_t guard;
    67         fibril_condvar_t change;
    6865        usb_address_t last_address;
    6966} usb_device_keeper_t;
    7067
    7168void usb_device_keeper_init(usb_device_keeper_t *instance);
    72 
    73 void usb_device_keeper_reserve_default_address(
    74     usb_device_keeper_t *instance, usb_speed_t speed);
    75 
    76 void usb_device_keeper_release_default_address(usb_device_keeper_t *instance);
    77 
    78 void usb_device_keeper_reset_if_need(usb_device_keeper_t *instance,
    79     usb_target_t target, const uint8_t *setup_data);
    8069
    8170usb_address_t device_keeper_get_free_address(usb_device_keeper_t *instance,
  • uspace/lib/usb/src/host/device_keeper.c

    ra81736d5 rc4e3b1f7  
    4848{
    4949        assert(instance);
    50         fibril_mutex_initialize(&instance->guard);
    51         fibril_condvar_initialize(&instance->change);
    52         instance->last_address = 0;
    5350        unsigned i = 0;
    5451        for (; i < USB_ADDRESS_COUNT; ++i) {
     
    6057        // (it is needed to allow smooth registration at default address)
    6158        instance->devices[0].occupied = true;
     59        instance->last_address = 0;
     60        fibril_mutex_initialize(&instance->guard);
    6261}
    63 /*----------------------------------------------------------------------------*/
    64 /** Attempt to obtain address 0, blocks.
    65  *
    66  * @param[in] instance Device keeper structure to use.
    67  * @param[in] speed Speed of the device requesting default address.
    68  */
    69 void usb_device_keeper_reserve_default_address(
    70     usb_device_keeper_t *instance, usb_speed_t speed)
    71 {
    72         assert(instance);
    73         fibril_mutex_lock(&instance->guard);
    74         while (instance->devices[USB_ADDRESS_DEFAULT].occupied) {
    75                 fibril_condvar_wait(&instance->change, &instance->guard);
    76         }
    77         instance->devices[USB_ADDRESS_DEFAULT].occupied = true;
    78         instance->devices[USB_ADDRESS_DEFAULT].speed = speed;
    79         fibril_mutex_unlock(&instance->guard);
    80 }
    81 /*----------------------------------------------------------------------------*/
    82 /** Attempt to obtain address 0, blocks.
    83  *
    84  * @param[in] instance Device keeper structure to use.
    85  * @param[in] speed Speed of the device requesting default address.
    86  */
    87 void usb_device_keeper_release_default_address(usb_device_keeper_t *instance)
    88 {
    89         assert(instance);
    90         fibril_mutex_lock(&instance->guard);
    91         instance->devices[USB_ADDRESS_DEFAULT].occupied = false;
    92         fibril_mutex_unlock(&instance->guard);
    93         fibril_condvar_signal(&instance->change);
    94 }
    95 /*----------------------------------------------------------------------------*/
    9662/*----------------------------------------------------------------------------*/
    9763/** Get a free USB address
     
    12086        assert(new_address != USB_ADDRESS_DEFAULT);
    12187        assert(instance->devices[new_address].occupied == false);
     88
    12289        instance->devices[new_address].occupied = true;
    12390        instance->devices[new_address].speed = speed;
    12491        instance->last_address = new_address;
     92
    12593        fibril_mutex_unlock(&instance->guard);
    12694        return new_address;
     
    138106        assert(instance);
    139107        fibril_mutex_lock(&instance->guard);
     108
    140109        assert(address > 0);
    141110        assert(address <= USB11_ADDRESS_MAX);
    142111        assert(instance->devices[address].occupied);
     112
    143113        instance->devices[address].handle = handle;
    144114        fibril_mutex_unlock(&instance->guard);
     
    159129        fibril_mutex_lock(&instance->guard);
    160130        assert(instance->devices[address].occupied);
     131
    161132        instance->devices[address].occupied = false;
    162133        fibril_mutex_unlock(&instance->guard);
     
    177148        while (address <= USB11_ADDRESS_MAX) {
    178149                if (instance->devices[address].handle == handle) {
     150                        assert(instance->devices[address].occupied);
    179151                        fibril_mutex_unlock(&instance->guard);
    180152                        return address;
     
    198170        assert(address >= 0);
    199171        assert(address <= USB11_ADDRESS_MAX);
     172
    200173        return instance->devices[address].speed;
    201174}
Note: See TracChangeset for help on using the changeset viewer.