Skip to content

Commit

Permalink
HID: usbhid: check for suspend or reset before restarting
Browse files Browse the repository at this point in the history
This patch (as1596) improves the queue-restart logic in usbhid by
checking to see if the device is suspended or a reset is about to
occur.  There's no point submitting an URB if either of those is
true.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
CC: Oliver Neukum <oliver@neukum.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Alan Stern authored and Jiri Kosina committed Jul 20, 2012
1 parent f2b5264 commit d4150c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions drivers/hid/usbhid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ static int usbhid_restart_out_queue(struct usbhid_device *usbhid)
int kicked;
int r;

if (!hid)
if (!hid || test_bit(HID_RESET_PENDING, &usbhid->iofl) ||
test_bit(HID_SUSPENDED, &usbhid->iofl))
return 0;

if ((kicked = (usbhid->outhead != usbhid->outtail))) {
Expand Down Expand Up @@ -245,7 +246,8 @@ static int usbhid_restart_ctrl_queue(struct usbhid_device *usbhid)
int r;

WARN_ON(hid == NULL);
if (!hid)
if (!hid || test_bit(HID_RESET_PENDING, &usbhid->iofl) ||
test_bit(HID_SUSPENDED, &usbhid->iofl))
return 0;

if ((kicked = (usbhid->ctrlhead != usbhid->ctrltail))) {
Expand Down

0 comments on commit d4150c8

Please sign in to comment.