HID: usbhid: no flushing if device is already polled
authorOliver Neukum <[email protected]>
Mon, 29 Jun 2015 09:10:41 +0000 (11:10 +0200)
committerJiri Kosina <[email protected]>
Wed, 8 Jul 2015 09:38:19 +0000 (11:38 +0200)
During open() it is unnecessary to wait for the device to flush
stale inputs if the device is polled while closed due to a quirk
or opening fails.

Signed-off-by: Oliver Neukum <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>
drivers/hid/usbhid/hid-core.c

index bfbe1bedda7f34396db34e85b79c89ee1a251209..1a23d78fe5e70228bfe2db590b58ba794a24d4c2 100644 (file)
@@ -710,7 +710,8 @@ int usbhid_open(struct hid_device *hid)
                 * Wait 50 msec for the queue to empty before allowing events
                 * to go through hid.
                 */
-               msleep(50);
+               if (res == 0 && !(hid->quirks & HID_QUIRK_ALWAYS_POLL))
+                       msleep(50);
                clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
        }
 done: