[PATCH 2/9] gpiolib: implement gpio_direction_input/output

Ahmad Fatoum a.fatoum at pengutronix.de
Mon Jan 16 05:44:54 PST 2023


These are straight wrappers around existing functions, but with a name
that's more like their Linux counterparts.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 include/gpiod.h | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/include/gpiod.h b/include/gpiod.h
index 8abf86db8682..df02b86e1ee8 100644
--- a/include/gpiod.h
+++ b/include/gpiod.h
@@ -57,12 +57,22 @@ static inline int gpiod_get(struct device *dev,
 	return dev_gpiod_get(dev, dev->of_node, _con_id, flags, NULL);
 }
 
-static inline void gpiod_set_value(int gpio, bool value)
+static inline void gpiod_direction_input(int gpio)
+{
+	gpio_direction_input(gpio);
+}
+
+static inline void gpiod_direction_output(int gpio, bool value)
 {
 	if (gpio != -ENOENT)
 		gpio_direction_active(gpio, value);
 }
 
+static inline void gpiod_set_value(int gpio, bool value)
+{
+	gpiod_direction_output(gpio, value);
+}
+
 static inline int gpiod_get_value(int gpio)
 {
 	if (gpio < 0)
-- 
2.30.2




More information about the barebox mailing list