]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Input: poller - convert locking to guard notation
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Thu, 7 Nov 2024 07:15:34 +0000 (23:15 -0800)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Tue, 24 Dec 2024 06:53:57 +0000 (22:53 -0800)
Use guard() notation instead of explicitly acquiring and releasing
mutex to simplify the code and ensure that it is released.

Link: https://lore.kernel.org/r/20241107071538.195340-8-dmitry.torokhov@gmail.com
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/input-poller.c

index 688e3cb1c2a0cbab90be24121e175b43b24dcbdf..9c57713a6151543c37546f60960231ed6c310e49 100644 (file)
@@ -162,7 +162,7 @@ static ssize_t input_dev_set_poll_interval(struct device *dev,
        if (interval > poller->poll_interval_max)
                return -EINVAL;
 
-       mutex_lock(&input->mutex);
+       guard(mutex)(&input->mutex);
 
        poller->poll_interval = interval;
 
@@ -172,8 +172,6 @@ static ssize_t input_dev_set_poll_interval(struct device *dev,
                        input_dev_poller_queue_work(poller);
        }
 
-       mutex_unlock(&input->mutex);
-
        return count;
 }