[PATCH v1 1/4] gpio: Split fwnode_is_gpiochip() helper

Andy Shevchenko <[email protected]>
Newsgroups org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-gpio,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
Many drivers repeat the same over and over. For clarity and robustness
split fwnode_is_gpiochip() helper.

Signed-off-by: Andy Shevchenko <[email protected]>
---
 include/linux/gpio/driver.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h
index 2ea21341adea..06d40fb77a73 100644
--- a/include/linux/gpio/driver.h
+++ b/include/linux/gpio/driver.h
@@ -879,9 +879,14 @@ static inline void gpiochip_unlock_as_irq(struct gpio_chip *gc,
 }
 #endif /* CONFIG_GPIOLIB */
 
+static inline bool fwnode_is_gpiochip(struct fwnode_handle *fwnode)
+{
+	return fwnode_property_present(child, "gpio-controller");
+}
+
 #define for_each_gpiochip_node(dev, child)					\
 	device_for_each_child_node(dev, child)					\
-		for_each_if(fwnode_property_present(child, "gpio-controller"))
+		for_each_if(fwnode_is_gpiochip(child))
 
 static inline unsigned int gpiochip_node_count(struct device *dev)
 {
-- 
2.50.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.