From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Dan Murphy <dmurphy@ti.com>
Cc: Jacek Anaszewski <jacek.anaszewski@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
devicetree <devicetree@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linux LED Subsystem <linux-leds@vger.kernel.org>
Subject: Re: [PATCH v7 2/2] leds: lm3601x: Introduce the lm3601x LED driver
Date: Tue, 22 May 2018 02:05:03 +0300 [thread overview]
Message-ID: <CAHp75Vf_KaRDJU83d8o1Sy1v+oztucJSYBEK9=cqNw6FQspFvg@mail.gmail.com> (raw)
In-Reply-To: <3b20c9cf-5f7e-3ed9-454d-c8e8ca6c0627@ti.com>
On Tue, May 22, 2018 at 12:44 AM, Dan Murphy <dmurphy@ti.com> wrote:
>>> + child = device_get_next_child_node(&led->client->dev, child);
>>> + if (!child) {
>>> + dev_err(&led->client->dev, "No LED Child node\n");
>>> + return ret;
>>> + }
>>> +
>>> + ret = fwnode_property_read_u32(child, "reg", &led->led_mode);
>>> + if (ret) {
>>> + dev_err(&led->client->dev, "reg DT property missing\n");
>>> + goto out_err;
>>> + }
>>> +
>>> + if (led->led_mode > LM3601X_LED_TORCH ||
>>> + led->led_mode < LM3601X_LED_IR) {
>>> + dev_warn(&led->client->dev, "Invalid led mode requested\n");
>>> + ret = -EINVAL;
>>> + goto out_err;
>>> + }
>>> +
>>> + ret = fwnode_property_read_string(child, "label", &name);
>>> + if (ret) {
>>> + if (led->led_mode == LM3601X_LED_TORCH)
>>> + name = "torch";
>>> + else
>>> + name = "infrared";
>>> + }
>>> +
>>> + snprintf(led->led_name, sizeof(led->led_name),
>>> + "%s:%s", node->name, name);
>>
>> Reading once again my recent explanation regarding this I realized
>> that I didn't provide clear conclusion, which is: we no longer
>> use child node name for LED class device name if label is absent.
>> (apart from that - you're using parent DT node now, i.e.
>> led-controller).
>>
>> Please follow what was done for drivers/leds/leds-cr0014114.c.
>
> Hmmm. If this is calling dev->of_node->name to store the name will this
> work in non-DT configurations?
I didn't found this kind of use in linux-next, perhaps I missed something?
In the driver Jacek referred to I found, though, use of of_node, which
at some point should be changed to fwnode.
For now you can fill that if you want to using something like this
(IIRC it should work):
if (is_of_node(fwnode))
...->of_node = to_of_node(...);
> I have not dug to deeply into the fwnode code to find out how the nodes
> get populated. So my question may not even be valid.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2018-05-21 23:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-21 18:09 [PATCH v7 1/2] dt: bindings: lm3601x: Introduce the lm3601x driver Dan Murphy
2018-05-21 18:09 ` [PATCH v7 2/2] leds: lm3601x: Introduce the lm3601x LED driver Dan Murphy
2018-05-21 20:44 ` Andy Shevchenko
2018-05-21 21:32 ` Dan Murphy
2018-05-21 21:09 ` Jacek Anaszewski
2018-05-21 21:44 ` Dan Murphy
2018-05-21 23:05 ` Andy Shevchenko [this message]
2018-05-22 12:17 ` Dan Murphy
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='CAHp75Vf_KaRDJU83d8o1Sy1v+oztucJSYBEK9=cqNw6FQspFvg@mail.gmail.com' \
--to=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=dmurphy@ti.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=robh+dt@kernel.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;
as well as URLs for NNTP newsgroup(s).