]> git.baikalelectronics.ru Git - kernel.git/commit
HID: usbhid: improve handling of Clear-Halt and reset
authorAlan Stern <stern@rowland.harvard.edu>
Tue, 2 Sep 2014 15:39:15 +0000 (11:39 -0400)
committerJiri Kosina <jkosina@suse.cz>
Wed, 3 Sep 2014 21:37:38 +0000 (23:37 +0200)
commit4ce1613561e1eb9f8cb868f5b3bc72703f12c8d4
tree7f053757c34528cbf56aac2ffc49fe7eb48623eb
parent25bec71beb0f0beafd38f828f7983e69a5cf1d2d
HID: usbhid: improve handling of Clear-Halt and reset

This patch changes the way usbhid carries out Clear-Halt and reset.

Currently, after a Clear-Halt on the interrupt-IN endpoint, the driver
immediately restarts the interrupt URB, even if the Clear-Halt failed.
This doesn't work out well when the reason for the failure was that
the device was disconnected (when a low- or full-speed device is
connected through a hub to an EHCI controller, transfer errors caused
by disconnection are reported as stalls by the hub).  Instead now the
driver will attempt a reset after a failed Clear-Halt.

The way resets are carried out is also changed.  Now the driver will
call usb_queue_reset_device() instead of calling usb_reset_device()
directly.  This avoids a deadlock that would arise when a device is
unplugged: The hid_reset() routine runs as a workqueue item, a reset
attempt after the device has been unplugged will fail, failure will
cause usbhid to be unbound, and the disconnect routine will try to do
cancel_work_sync().  The usb_queue_reset_device() implementation is
carefully written to handle scenarios like this one properly.

Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/usbhid/hid-core.c