From: "Rafał Miłecki" <zajec5@gmail.com>
To: Jacek Anaszewski <j.anaszewski@samsung.com>
Cc: Richard Purdie <rpurdie@rpsys.net>,
"open list:LED SUBSYSTEM" <linux-leds@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] leds: leds-gpio: Set of_node for created LED devices
Date: Mon, 11 Jul 2016 10:23:15 +0200 [thread overview]
Message-ID: <57835773.9070907@gmail.com> (raw)
In-Reply-To: <578356BD.8000309@samsung.com>
On 07/11/2016 10:20 AM, Jacek Anaszewski wrote:
> On 07/11/2016 09:52 AM, Rafał Miłecki wrote:
>> On 07/11/2016 09:34 AM, Jacek Anaszewski wrote:
>>> On 07/08/2016 02:53 PM, Rafał Miłecki wrote:
>>>> When working with Device Tree we iterate over children of "gpio-leds"
>>>> compatible node and create LED device for each of them. We take care of
>>>> all common DT properties (label, default trigger, state, etc.), however
>>>> some triggers may want to support more of them.
>>>>
>>>> It could be useful for timer trigger to support setting delay on/off
>>>> values with Device Tree property. Or for transient trigger to support
>>>> e.g. duration property.
>>>>
>>>> We obviously should handle such properties in triggers, not in generic
>>>> code. To let trigger drivers read properties from DT node we need to set
>>>> of_node to point the relevant node. This change allows using all kind of
>>>> of helpers in e.g. "activate" callbacks.
>>>>
>>>> Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
>>>> ---
>>>> drivers/leds/leds-gpio.c | 5 +++--
>>>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>>>
>>>> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
>>>> index 8229f06..9b991d4 100644
>>>> --- a/drivers/leds/leds-gpio.c
>>>> +++ b/drivers/leds/leds-gpio.c
>>>> @@ -165,6 +165,7 @@ static struct gpio_leds_priv
>>>> *gpio_leds_create(struct platform_device *pdev)
>>>> return ERR_PTR(-ENOMEM);
>>>>
>>>> device_for_each_child_node(dev, child) {
>>>> + struct gpio_led_data *led_dat = &priv->leds[priv->num_leds];
>>>
>>> This seems to be an unrelated change.
>>
>> We already got
>> &priv->leds[priv->num_leds]
>> and I needed to add
>> priv->leds[priv->num_leds].cdev.dev->of_node
>>
>> I didn't want to duplicate code accessing so deep struct, so I added a
>> helper.
>>
>> Is that a good explanation? Or would you like me to change this code?
>
> Ah, I missed that. Patch applied.
Thanks :)
prev parent reply other threads:[~2016-07-11 8:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-08 12:53 [PATCH] leds: leds-gpio: Set of_node for created LED devices Rafał Miłecki
2016-07-11 7:34 ` Jacek Anaszewski
2016-07-11 7:52 ` Rafał Miłecki
2016-07-11 8:20 ` Jacek Anaszewski
2016-07-11 8:23 ` Rafał Miłecki [this message]
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=57835773.9070907@gmail.com \
--to=zajec5@gmail.com \
--cc=j.anaszewski@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).