summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-lenovo.c
diff options
context:
space:
mode:
authorAlan Stern2016-03-23 17:17:09 +0100
committerJiri Kosina2016-03-24 15:26:20 +0100
commit972e6a993f278b416a8ee3ec65475724fc36feb2 (patch)
tree89e205596257268d95037d088cb9f2f165f56725 /drivers/hid/hid-lenovo.c
parentHID: wiimote: Fix wiimote mp scale linearization (diff)
downloadkernel-qcow2-linux-972e6a993f278b416a8ee3ec65475724fc36feb2.tar.gz
kernel-qcow2-linux-972e6a993f278b416a8ee3ec65475724fc36feb2.tar.xz
kernel-qcow2-linux-972e6a993f278b416a8ee3ec65475724fc36feb2.zip
HID: usbhid: fix inconsistent reset/resume/reset-resume behavior
The usbhid driver has inconsistently duplicated code in its post-reset, resume, and reset-resume pathways. reset-resume doesn't check HID_STARTED before trying to restart the I/O queues. resume fails to clear the HID_SUSPENDED flag if HID_STARTED isn't set. resume calls usbhid_restart_queues() with usbhid->lock held and the others call it without holding the lock. The first item in particular causes a problem following a reset-resume if the driver hasn't started up its I/O. URB submission fails because usbhid->urbin is NULL, and this triggers an unending reset-retry loop. This patch fixes the problem by creating a new subroutine, hid_restart_io(), to carry out all the common activities. It also adds some checks that were missing in the original code: After a reset, there's no need to clear any halted endpoints. After a resume, if a reset is pending there's no need to restart any I/O until the reset is finished. After a resume, if the interrupt-IN endpoint is halted there's no need to submit the input URB until the halt has been cleared. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Reported-by: Daniel Fraga <fragabr@gmail.com> Tested-by: Daniel Fraga <fragabr@gmail.com> CC: <stable@vger.kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/hid-lenovo.c')
0 files changed, 0 insertions, 0 deletions