From: Andy Shevchenko Date: Fri, 1 Apr 2022 10:35:52 +0000 (+0300) Subject: gpiolib: Introduce for_each_gpiochip_node() loop helper X-Git-Tag: v6.1-rc5~1223^2~31^2~14 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=85ebb1a6bd62147ebcfa70500d513331a8daf9e0;p=platform%2Fkernel%2Flinux-starfive.git gpiolib: Introduce for_each_gpiochip_node() loop helper Introduce for_each_gpiochip_node() loop helper which iterates over the GPIO controller child nodes of a given device. Signed-off-by: Andy Shevchenko Reviewed-by: Geert Uytterhoeven Tested-by: Geert Uytterhoeven Acked-by: Bartosz Golaszewski --- diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 98c93510..bfc91f1 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -3,13 +3,14 @@ #define __LINUX_GPIO_DRIVER_H #include -#include #include #include #include #include #include #include +#include +#include struct gpio_desc; struct of_phandle_args; @@ -750,4 +751,8 @@ static inline void gpiochip_unlock_as_irq(struct gpio_chip *gc, } #endif /* CONFIG_GPIOLIB */ +#define for_each_gpiochip_node(dev, child) \ + device_for_each_child_node(dev, child) \ + if (!fwnode_property_present(child, "gpio-controller")) {} else + #endif /* __LINUX_GPIO_DRIVER_H */