summaryrefslogtreecommitdiffstats
path: root/drivers/staging
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-10 18:22:48 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-10 18:22:48 +0200
commita91ab911df51ac364e594d5950ed508d91091498 (patch)
tree035d64bd871f752b74f9e8128244311e702d95d4 /drivers/staging
parentMerge tag 'drm-for-v4.13' of git://people.freedesktop.org/~airlied/linux (diff)
parentMerge branches 'for-4.13/multitouch', 'for-4.13/retrode', 'for-4.13/transport... (diff)
downloadlinux-a91ab911df51ac364e594d5950ed508d91091498.tar.xz
linux-a91ab911df51ac364e594d5950ed508d91091498.zip
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
Pull HID updates from Jiri Kosina: - open/close tracking improvements from Dmitry Torokhov - battery support improvements in Wacom driver from Jason Gerecke - Win8 support fixes from Benjamin Tissories and Hans de Geode - misc fixes to Intel-ISH driver from Arnd Bergmann - support for quite a few new devices and small assorted fixes here and there * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (35 commits) HID: intel-ish-hid: Enable Gemini Lake ish driver HID: intel-ish-hid: Enable Cannon Lake ish driver HID: wacom: fix mistake in printk HID: multitouch: optimize the sticky fingers timer HID: multitouch: fix rare Win 8 cases when the touch up event gets missing HID: multitouch: use BIT macro HID: Add driver for Retrode2 joypad adapter HID: multitouch: Add support for Google Rose Touchpad HID: multitouch: Support PTP Stick and Touchpad device HID: core: don't use negative operands when shift HID: apple: Use country code to detect ISO keyboards HID: remove no longer used hid->open field greybus: hid: remove custom locking from gb_hid_open/close HID: usbhid: remove custom locking from usbhid_open/close HID: i2c-hid: remove custom locking from i2c_hid_open/close HID: serialize hid_hw_open and hid_hw_close HID: usbhid: do not rely on hid->open when deciding to do IO HID: hiddev: use hid_hw_power instead of usbhid_get/put_power HID: hiddev: use hid_hw_open/close instead of usbhid_open/close HID: asus: Add support for Zen AiO MD-5110 keyboard ...
Diffstat (limited to 'drivers/staging')
-rw-r--r--drivers/staging/greybus/hid.c43
1 files changed, 14 insertions, 29 deletions
diff --git a/drivers/staging/greybus/hid.c b/drivers/staging/greybus/hid.c
index 730d746fc4c2..465101bbab69 100644
--- a/drivers/staging/greybus/hid.c
+++ b/drivers/staging/greybus/hid.c
@@ -32,8 +32,6 @@ struct gb_hid {
char *inbuf;
};
-static DEFINE_MUTEX(gb_hid_open_mutex);
-
/* Routines to get controller's information over greybus */
/* Operations performed on greybus */
@@ -346,19 +344,14 @@ static void gb_hid_stop(struct hid_device *hid)
static int gb_hid_open(struct hid_device *hid)
{
struct gb_hid *ghid = hid->driver_data;
- int ret = 0;
-
- mutex_lock(&gb_hid_open_mutex);
- if (!hid->open++) {
- ret = gb_hid_set_power(ghid, GB_HID_TYPE_PWR_ON);
- if (ret < 0)
- hid->open--;
- else
- set_bit(GB_HID_STARTED, &ghid->flags);
- }
- mutex_unlock(&gb_hid_open_mutex);
+ int ret;
- return ret;
+ ret = gb_hid_set_power(ghid, GB_HID_TYPE_PWR_ON);
+ if (ret < 0)
+ return ret;
+
+ set_bit(GB_HID_STARTED, &ghid->flags);
+ return 0;
}
static void gb_hid_close(struct hid_device *hid)
@@ -366,21 +359,13 @@ static void gb_hid_close(struct hid_device *hid)
struct gb_hid *ghid = hid->driver_data;
int ret;
- /*
- * Protecting hid->open to make sure we don't restart data acquistion
- * due to a resumption we no longer care about..
- */
- mutex_lock(&gb_hid_open_mutex);
- if (!--hid->open) {
- clear_bit(GB_HID_STARTED, &ghid->flags);
-
- /* Save some power */
- ret = gb_hid_set_power(ghid, GB_HID_TYPE_PWR_OFF);
- if (ret)
- dev_err(&ghid->connection->bundle->dev,
- "failed to power off (%d)\n", ret);
- }
- mutex_unlock(&gb_hid_open_mutex);
+ clear_bit(GB_HID_STARTED, &ghid->flags);
+
+ /* Save some power */
+ ret = gb_hid_set_power(ghid, GB_HID_TYPE_PWR_OFF);
+ if (ret)
+ dev_err(&ghid->connection->bundle->dev,
+ "failed to power off (%d)\n", ret);
}
static int gb_hid_power(struct hid_device *hid, int lvl)