linux-uconsole/drivers/hid/usbhid
Dmitry Torokhov dcdaaa0b13 HID: hiddev: fix mess in hiddev_open()
commit 18a1b06e5b upstream.

The open method of hiddev handler fails to bring the device out of
autosuspend state as was promised in 0361a28d3f, as it actually has 2
blocks that try to start the transport (call hid_hw_open()) with both
being guarded by the "open" counter, so the 2nd block is never executed as
the first block increments the counter so it is never at 0 when we check
it for the second block.

Additionally hiddev_open() was leaving counter incremented on errors,
causing the device to never be reopened properly if there was ever an
error.

Let's fix all of this by factoring out code that creates client structure
and powers up the device into a separate function that is being called
from usbhid_open() with the "existancelock" being held.

Fixes: 0361a28d3f ("HID: autosuspend support for USB HID")
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-01-14 20:07:07 +01:00
..
hid-core.c HID: usbhid: use irqsave() in USB's complete callback 2018-06-25 15:24:46 +02:00
hid-pidff.c HID: pidff: effect can't be NULL 2015-03-27 16:03:26 +01:00
hiddev.c HID: hiddev: fix mess in hiddev_open() 2020-01-14 20:07:07 +01:00
Kconfig docs: fix broken references with multiple hints 2018-06-15 18:10:01 -03:00
Makefile HID: core: move the dynamic quirks handling in core 2017-11-21 11:14:48 +01:00
usbhid.h HID: usbhid: do not rely on hid->open when deciding to do IO 2017-06-08 13:56:09 +02:00
usbkbd.c HID: usbkbd: constify usb_device_id and fix space before '[' error. 2017-08-10 11:07:49 +02:00
usbmouse.c HID: usbmouse: constify usb_device_id and fix space before '[' error 2017-08-10 11:07:49 +02:00