summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2017-09-05 11:08:52 +0200
committerJiri Kosina <jkosina@suse.cz>2017-09-05 11:08:52 +0200
commit2682b892368bf304e7ecddd9ac68045db516a009 (patch)
tree6af4dfef616563906fe34ca66f2ba93a4cca6811 /drivers
parentaaf4f13c456f5fb513d907ede137e8ba77d6adfb (diff)
parent6f68f0ac72087c29a94d1736324902e3ec07a4ec (diff)
Merge branch 'for-4.14/driver-lock-removal' into for-linus
- Arnd pointed out that driver_lock semaphore is superfluous, as driver core already provides all the necessary concurency protection. Removal patch from Binoy Jayan
Diffstat (limited to 'drivers')
-rw-r--r--drivers/hid/hid-core.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
index d946d561e064..9bc91160819b 100644
--- a/drivers/hid/hid-core.c
+++ b/drivers/hid/hid-core.c
@@ -2488,11 +2488,9 @@ static int hid_device_probe(struct device *dev)
const struct hid_device_id *id;
int ret = 0;
- if (down_interruptible(&hdev->driver_lock))
- return -EINTR;
if (down_interruptible(&hdev->driver_input_lock)) {
ret = -EINTR;
- goto unlock_driver_lock;
+ goto end;
}
hdev->io_started = false;
@@ -2519,8 +2517,7 @@ static int hid_device_probe(struct device *dev)
unlock:
if (!hdev->io_started)
up(&hdev->driver_input_lock);
-unlock_driver_lock:
- up(&hdev->driver_lock);
+end:
return ret;
}
@@ -2530,11 +2527,9 @@ static int hid_device_remove(struct device *dev)
struct hid_driver *hdrv;
int ret = 0;
- if (down_interruptible(&hdev->driver_lock))
- return -EINTR;
if (down_interruptible(&hdev->driver_input_lock)) {
ret = -EINTR;
- goto unlock_driver_lock;
+ goto end;
}
hdev->io_started = false;
@@ -2550,8 +2545,7 @@ static int hid_device_remove(struct device *dev)
if (!hdev->io_started)
up(&hdev->driver_input_lock);
-unlock_driver_lock:
- up(&hdev->driver_lock);
+end:
return ret;
}
@@ -3009,7 +3003,6 @@ struct hid_device *hid_allocate_device(void)
init_waitqueue_head(&hdev->debug_wait);
INIT_LIST_HEAD(&hdev->debug_list);
spin_lock_init(&hdev->debug_list_lock);
- sema_init(&hdev->driver_lock, 1);
sema_init(&hdev->driver_input_lock, 1);
mutex_init(&hdev->ll_open_lock);