mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
HID: Remove the semaphore driver_lock
The semaphore 'driver_lock' is used as a simple mutex, and also unnecessary as suggested by Arnd. Hence removing it, as the concurrency between the probe and remove is already handled in the driver core. Suggested-by: Arnd Bergmann <[email protected]> Signed-off-by: Binoy Jayan <[email protected]> Acked-by: Benjamin Tissoires <[email protected]> Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
This commit is contained in:
parent
a9d0683e0b
commit
6f68f0ac72
2 changed files with 5 additions and 13 deletions
|
|
@ -2487,11 +2487,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;
|
||||
|
||||
|
|
@ -2518,8 +2516,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;
|
||||
}
|
||||
|
||||
|
|
@ -2529,11 +2526,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;
|
||||
|
||||
|
|
@ -2549,8 +2544,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;
|
||||
}
|
||||
|
||||
|
|
@ -3008,7 +3002,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);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue