Input: usbtouchscreen - do not rely on input_dev->users
authorMarcus Folkesson <marcus.folkesson@gmail.com>
Sat, 17 Mar 2018 17:54:13 +0000 (10:54 -0700)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Mon, 26 Mar 2018 22:22:16 +0000 (15:22 -0700)
commit85f46fbf5e242ef923fd313722e65cb6d2170149
treea20e6021842e99f6a828a3cb3a4529e36cf2f257
parent12e510dbc57b29b4314cd792851532bea76b4715
Input: usbtouchscreen - do not rely on input_dev->users

If the device is unused and suspended, a call to open will cause the
device to autoresume through the call to usb_autopm_get_interface().

input_dev->users is already incremented by the input subsystem,
therefore this expression will always be evaluated to true:

if (input->users || usbtouch->type->irq_always)
result = usb_submit_urb(usbtouch->irq, GFP_NOIO);

The same URB will then be fail when resubmitted in usbtouch_open().

Introduce usbtouch->is_open to keep track of the state instead.

Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/touchscreen/usbtouchscreen.c