[RFC PATCH 3/7] gpio: gpiolib: save GPIO flags in of_get_named_gpiod_flags

Ludovic Desroches ludovic.desroches at microchip.com
Thu Dec 14 06:21:34 PST 2017


When we get a GPIO descriptor from the device device, the flags
are updated for the caller to know if the GPIO is active low or
high. After calling of_get_named_gpio_flags the next step is
usually calling gpiod_request which doesn't take flags as a
parameter.
Updating the flags of the GPIO descriptor will allow to configure
the GPIO when it will be requested.

Signed-off-by: Ludovic Desroches <ludovic.desroches at microchip.com>
---
 drivers/gpio/gpiolib-of.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 4a2b8d3397c7..67b1a7ff1e97 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -97,6 +97,8 @@ struct gpio_desc *of_get_named_gpiod_flags(struct device_node *np,
 		 __func__, propname, np, index,
 		 PTR_ERR_OR_ZERO(desc));
 
+	gpiod_configure_flags(desc, propname, *flags, 0);
+
 out:
 	of_node_put(gpiospec.np);
 
-- 
2.12.2




More information about the linux-arm-kernel mailing list