diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-04-08 21:18:51 +0300 |
---|---|---|
committer | Bartosz Golaszewski <brgl@bgdev.pl> | 2022-04-09 22:38:17 +0200 |
commit | 66f46e370a9aec05524cdffde4062953e6ba2e08 (patch) | |
tree | a29d0ca07271d5ecc1457ddadc3c68af1f26b885 /drivers/gpio/gpiolib.h | |
parent | 57017edd46f835c85642fe8299f13b0db61d4c31 (diff) | |
download | lwn-66f46e370a9aec05524cdffde4062953e6ba2e08.tar.gz lwn-66f46e370a9aec05524cdffde4062953e6ba2e08.zip |
gpiolib: Split out for_each_gpio_desc() macro
In some cases we want to traverse all GPIO descriptors for given
chip, let's split out for_each_gpio_desc() macro for such cases.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Diffstat (limited to 'drivers/gpio/gpiolib.h')
-rw-r--r-- | drivers/gpio/gpiolib.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/gpio/gpiolib.h b/drivers/gpio/gpiolib.h index 7bac62d36f0c..eef3ec073d9e 100644 --- a/drivers/gpio/gpiolib.h +++ b/drivers/gpio/gpiolib.h @@ -100,10 +100,13 @@ struct gpio_array { struct gpio_desc *gpiochip_get_desc(struct gpio_chip *gc, unsigned int hwnum); -#define for_each_gpio_desc_with_flag(gc, desc, flag) \ +#define for_each_gpio_desc(gc, desc) \ for (unsigned int __i = 0; \ __i < gc->ngpio && (desc = gpiochip_get_desc(gc, __i)); \ __i++) \ + +#define for_each_gpio_desc_with_flag(gc, desc, flag) \ + for_each_gpio_desc(gc, desc) \ if (!test_bit(flag, &desc->flags)) {} else int gpiod_get_array_value_complex(bool raw, bool can_sleep, |