HID: serialize hid_hw_open and hid_hw_close
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 7 Jun 2017 06:59:34 +0000 (23:59 -0700)
committerJiri Kosina <jkosina@suse.cz>
Thu, 8 Jun 2017 11:56:09 +0000 (13:56 +0200)
commitaaac082dac0a8ac6b00509c7ae2fa8280f966652
treea7b5f120070f8d399d784f1b5601a09c50822291
parent28cbc863f4bfa92c26143493f0463e4eb96a1783
HID: serialize hid_hw_open and hid_hw_close

The HID transport drivers either re-implement exactly the same logic
(usbhid, i2c-hid) or forget to implement it (usbhid) which causes issues
when the same device is accessed via multiple interfaces (for example input
device through evdev and also hidraw). Let's muve the locking logic into
HID core to make sure the serialized behavior is always enforced.

Also let's uninline and move hid_hw_start() and hid_hw_stop() into hid-core
as hid_hw_start() is somewhat large and do not believe we get any benefit
from these two being inline.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/hid-core.c
include/linux/hid.h