From: Dmitry Torokhov Date: Thu, 7 Nov 2024 07:15:34 +0000 (-0800) Subject: Input: poller - convert locking to guard notation X-Git-Tag: block-6.14-20240131~10^2^2~9 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=f951e94247e2e0cce9b28526b7e25ad95785e8c1;p=linux-block.git Input: poller - convert locking to guard notation 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 --- diff --git a/drivers/input/input-poller.c b/drivers/input/input-poller.c index 688e3cb1c2a0..9c57713a6151 100644 --- a/drivers/input/input-poller.c +++ b/drivers/input/input-poller.c @@ -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; }