Skip to content

Commit f951e94

Browse files
committed
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 <dmitry.torokhov@gmail.com>
1 parent 5bb6e29 commit f951e94

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/input/input-poller.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static ssize_t input_dev_set_poll_interval(struct device *dev,
162162
if (interval > poller->poll_interval_max)
163163
return -EINVAL;
164164

165-
mutex_lock(&input->mutex);
165+
guard(mutex)(&input->mutex);
166166

167167
poller->poll_interval = interval;
168168

@@ -172,8 +172,6 @@ static ssize_t input_dev_set_poll_interval(struct device *dev,
172172
input_dev_poller_queue_work(poller);
173173
}
174174

175-
mutex_unlock(&input->mutex);
176-
177175
return count;
178176
}
179177

0 commit comments

Comments
 (0)