diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-02-01 18:27:56 +0300 |
---|---|---|
committer | Bartosz Golaszewski <brgl@bgdev.pl> | 2022-02-08 12:35:49 +0300 |
commit | 80c78fbeef10121a0fbba3fd2ed333f5de118f6d (patch) | |
tree | 2ac77439b974b3e37fe4909bec319da190239e55 /drivers/gpio/gpiolib.c | |
parent | 0868ad385affa28cf15aebca3c38c5c51f79b286 (diff) | |
download | linux-80c78fbeef10121a0fbba3fd2ed333f5de118f6d.tar.xz |
gpiolib: Introduce for_each_gpio_desc_with_flag() macro
In a few places we are using a loop against all GPIO descriptors
with a given flag for a given device. Replace it with a consolidated
for_each type of macro.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r-- | drivers/gpio/gpiolib.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index 3859911b61e9..e3702bc1b533 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -4102,12 +4102,11 @@ int gpiod_hog(struct gpio_desc *desc, const char *name, */ static void gpiochip_free_hogs(struct gpio_chip *gc) { + struct gpio_desc *desc; int id; - for (id = 0; id < gc->ngpio; id++) { - if (test_bit(FLAG_IS_HOGGED, &gc->gpiodev->descs[id].flags)) - gpiochip_free_own_desc(&gc->gpiodev->descs[id]); - } + for_each_gpio_desc_with_flag(id, gc, desc, FLAG_IS_HOGGED) + gpiochip_free_own_desc(desc); } /** |