summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-04-14 21:42:48 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-04-14 21:47:29 +0300
commitaf47d8033fc731f19600efd27ba4a7d0fdfcc77c (patch)
treeea9d96b853bfb9d8dd01738d2c7e53d121403cfc
parent492fca28fae8e4aa93c1b054423c152d540a36e8 (diff)
downloadlinux-stable-af47d8033fc731f19600efd27ba4a7d0fdfcc77c.tar.gz
linux-stable-af47d8033fc731f19600efd27ba4a7d0fdfcc77c.tar.bz2
linux-stable-af47d8033fc731f19600efd27ba4a7d0fdfcc77c.zip
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 <andriy.shevchenko@linux.intel.com> Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
-rw-r--r--include/linux/gpio/driver.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 12de0b22b4ef..83e2d72e51bb 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 */