[PATCH 2/4] gpiolib: fix of_hog_gpio gpio label assignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Current the label is retrieved by the line-name property but this is a
optional property. In case of a missing line-name property the label is
NULL. As the binding documentation told, the gpio-label must be set to
the device-node name in case of missing line-name property.

Fixes: 37e6bee7e5 ("gpiolib: Add support for GPIO "hog" nodes")
Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx>
---
 drivers/gpio/gpiolib.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 4e0bf73742..982bec0b69 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -382,7 +382,10 @@ static int of_hog_gpio(struct device_node *np, struct gpio_chip *chip,
 	else
 		return -EINVAL;
 
-	of_property_read_string(np, "line-name", &name);
+	/* The line-name is optional and if not present the node name is used */
+	ret = of_property_read_string(np, "line-name", &name);
+	if (ret < 0)
+		name = np->name;
 
 	return gpio_request_one(gpio, flags, name);
 }
-- 
2.19.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux