Changeset f750345 in mainline


Ignore:
Timestamp:
2011-11-07T11:05:42Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
2155955
Parents:
0f12c17
Message:

usbhid: Refactor wait loop.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/bus/usb/usbhid/main.c

    r0f12c17 rf750345  
    193193static int usb_hid_device_gone(usb_device_t *dev)
    194194{
     195        assert(dev);
     196        assert(dev->driver_data);
    195197        usb_hid_dev_t *hid_dev = dev->driver_data;
    196         unsigned tries = 10;
    197         while (hid_dev->running) {
     198        unsigned tries = 100;
     199        /* Wait for fail. */
     200        while (hid_dev->running && tries--) {
    198201                async_usleep(100000);
    199                 if (!tries--) {
    200                         usb_log_error("Can't remove hid, still running.\n");
    201                         return EBUSY;
    202                 }
    203         }
    204 
    205         assert(!hid_dev->running);
     202        }
     203        if (hid_dev->running) {
     204                usb_log_error("Can't remove hid, still running.\n");
     205                return EBUSY;
     206        }
     207
    206208        usb_hid_deinit(hid_dev);
    207209        usb_log_debug2("%s destruction complete.\n", dev->ddf_dev->name);
Note: See TracChangeset for help on using the changeset viewer.