From: Andy Shevchenko Date: Thu, 14 Apr 2022 18:42:48 +0000 (+0300) Subject: gpiolib: Introduce a helper to get first GPIO controller node X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=af47d8033fc731f19600efd27ba4a7d0fdfcc77c;p=linux.git gpiolib: Introduce a helper to get first GPIO controller node Introduce a helper to get first GPIO controller node which drivers may want to use. Signed-off-by: Andy Shevchenko Tested-by: Marek Szyprowski --- diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 12de0b22b4ef0..83e2d72e51bb5 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -766,4 +766,14 @@ static inline unsigned int gpiochip_node_count(struct device *dev) return count; } +static inline struct fwnode_handle *gpiochip_node_get_first(struct device *dev) +{ + struct fwnode_handle *fwnode; + + for_each_gpiochip_node(dev, fwnode) + return fwnode; + + return NULL; +} + #endif /* __LINUX_GPIO_DRIVER_H */