mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-14 04:09:18 -04:00
gpiolib: Convert to use guard()() for gpio_machine_hogs_mutex
The driver uses guard()()/scoped_guard() for the rest of the synchronisation calls. Convert to use the same for gpio_machine_hogs_mutex. Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20250416095645.2027695-3-andriy.shevchenko@linux.intel.com Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
This commit is contained in:
committed by
Bartosz Golaszewski
parent
f1d6cd0774
commit
d4fe58c8ea
@@ -888,14 +888,12 @@ static void machine_gpiochip_add(struct gpio_chip *gc)
|
||||
{
|
||||
struct gpiod_hog *hog;
|
||||
|
||||
mutex_lock(&gpio_machine_hogs_mutex);
|
||||
guard(mutex)(&gpio_machine_hogs_mutex);
|
||||
|
||||
list_for_each_entry(hog, &gpio_machine_hogs, list) {
|
||||
if (!strcmp(gc->label, hog->chip_label))
|
||||
gpiochip_machine_hog(gc, hog);
|
||||
}
|
||||
|
||||
mutex_unlock(&gpio_machine_hogs_mutex);
|
||||
}
|
||||
|
||||
static void gpiochip_setup_devs(void)
|
||||
@@ -4439,7 +4437,7 @@ void gpiod_add_hogs(struct gpiod_hog *hogs)
|
||||
{
|
||||
struct gpiod_hog *hog;
|
||||
|
||||
mutex_lock(&gpio_machine_hogs_mutex);
|
||||
guard(mutex)(&gpio_machine_hogs_mutex);
|
||||
|
||||
for (hog = &hogs[0]; hog->chip_label; hog++) {
|
||||
list_add_tail(&hog->list, &gpio_machine_hogs);
|
||||
@@ -4453,8 +4451,6 @@ void gpiod_add_hogs(struct gpiod_hog *hogs)
|
||||
if (gdev)
|
||||
gpiochip_machine_hog(gpio_device_get_chip(gdev), hog);
|
||||
}
|
||||
|
||||
mutex_unlock(&gpio_machine_hogs_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpiod_add_hogs);
|
||||
|
||||
@@ -4462,10 +4458,10 @@ void gpiod_remove_hogs(struct gpiod_hog *hogs)
|
||||
{
|
||||
struct gpiod_hog *hog;
|
||||
|
||||
mutex_lock(&gpio_machine_hogs_mutex);
|
||||
guard(mutex)(&gpio_machine_hogs_mutex);
|
||||
|
||||
for (hog = &hogs[0]; hog->chip_label; hog++)
|
||||
list_del(&hog->list);
|
||||
mutex_unlock(&gpio_machine_hogs_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(gpiod_remove_hogs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user