mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Marco Felsch <m.felsch@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/4] gpiolib: fix of_hog_gpio gpio label assignment
Date: Thu, 18 Oct 2018 12:43:47 +0200	[thread overview]
Message-ID: <20181018104349.26332-3-m.felsch@pengutronix.de> (raw)
In-Reply-To: <20181018104349.26332-1-m.felsch@pengutronix.de>

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>
---
 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@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2018-10-18 10:44 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 10:43 [PATCH 0/4] gpio-hog fixes Marco Felsch
2018-10-18 10:43 ` [PATCH 1/4] gpiolib: fix of_gpio_hog error handling Marco Felsch
2018-10-18 10:43 ` Marco Felsch [this message]
2018-10-18 10:43 ` [PATCH 3/4] gpio: tree-wide don't probe devices during core_initcall Marco Felsch
2018-10-18 10:43 ` [PATCH 4/4] pinctrl: tree-wide " Marco Felsch
2018-10-19 12:19 ` [PATCH 0/4] gpio-hog fixes Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181018104349.26332-3-m.felsch@pengutronix.de \
    --to=m.felsch@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox