From d4150c8f3d80b4a9387083478a86da8b3390dd83 Mon Sep 17 00:00:00 2001 From: Alan Stern Date: Thu, 19 Jul 2012 16:08:54 -0400 Subject: HID: usbhid: check for suspend or reset before restarting 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 CC: Oliver Neukum Signed-off-by: Jiri Kosina --- drivers/hid/usbhid/hid-core.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'drivers/hid') diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 271578b85d91..4309c03038f6 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -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))) { @@ -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))) { -- cgit v1.2.3-59-g8ed1b