diff options
author | Marco Felsch <m.felsch@pengutronix.de> | 2018-10-18 12:43:47 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-10-19 14:18:58 +0200 |
commit | d023a038222db319d5d56b471ba76581fdb3b269 (patch) | |
tree | 05ffb18c4f5b140502ce58fcb60e3adbdb497527 /drivers/gpio | |
parent | 94d60ed19b966c1ff7644273aeb31bd89013df4f (diff) | |
download | barebox-d023a038222db319d5d56b471ba76581fdb3b269.tar.gz barebox-d023a038222db319d5d56b471ba76581fdb3b269.tar.xz |
gpiolib: fix of_hog_gpio gpio label assignment
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@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/gpio')
-rw-r--r-- | drivers/gpio/gpiolib.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); } |