From: Fabio Estevam <festevam@gmail.com>
To: cooloney@gmail.com
Cc: rpurdie@rpsys.net, jean-michel.hautbois@vodalys.com,
grant.likely@linaro.org, rafael.j.wysocki@intel.com,
mika.westerberg@linux.intel.com, linux-leds@vger.kernel.org,
Fabio Estevam <fabio.estevam@freescale.com>
Subject: [PATCH] leds: leds-gpio: Fix multiple instances registration when 'label' property is absent
Date: Wed, 3 Dec 2014 15:34:33 -0200 [thread overview]
Message-ID: <1417628073-22013-1-git-send-email-festevam@gmail.com> (raw)
From: Fabio Estevam <fabio.estevam@freescale.com>
Since commit a43f2cbbb009f96 ("leds: leds-gpio: Make use of device property
API") it is no longer possible to register multiple gpio leds without passing
the 'label' property.
According to Documentation/devicetree/bindings/leds/common.txt:
"Optional properties for child nodes:
- label : The label for this LED. If omitted, the label is
taken from the node name (excluding the unit address)."
So retrieve the node name when the 'label' property is absent to keep the old
behaviour and fix this regression.
Reported-by: Jean-Michel Hautbois <jean-michel.hautbois@vodalys.com>
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/leds/leds-gpio.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index fd53968..a635330 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -170,6 +170,7 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
struct fwnode_handle *child;
struct gpio_leds_priv *priv;
int count, ret;
+ struct device_node *np;
count = device_get_child_node_count(dev);
if (!count)
@@ -189,7 +190,12 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
goto err;
}
- fwnode_property_read_string(child, "label", &led.name);
+ np = of_node(child);
+
+ if (fwnode_property_present(child, "label"))
+ fwnode_property_read_string(child, "label", &led.name);
+ else
+ led.name = np->name;
fwnode_property_read_string(child, "linux,default-trigger",
&led.default_trigger);
--
1.9.1
next reply other threads:[~2014-12-03 17:35 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-03 17:34 Fabio Estevam [this message]
2014-12-03 17:40 ` [PATCH] leds: leds-gpio: Fix multiple instances registration when 'label' property is absent Grant Likely
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=1417628073-22013-1-git-send-email-festevam@gmail.com \
--to=festevam@gmail.com \
--cc=cooloney@gmail.com \
--cc=fabio.estevam@freescale.com \
--cc=grant.likely@linaro.org \
--cc=jean-michel.hautbois@vodalys.com \
--cc=linux-leds@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=rpurdie@rpsys.net \
/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