All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacek Anaszewski <j.anaszewski@samsung.com>
To: Simon Guinot <simon.guinot@sequanux.org>
Cc: Andrew Lunn <andrew@lunn.ch>, Jason Cooper <jason@lakedaemon.net>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	Bryan Wu <cooloney@gmail.com>,
	Vincent Donnefort <vdonnefort@gmail.com>,
	Richard Purdie <rpurdie@rpsys.net>,
	linux-arm-kernel@lists.infradead.org,
	Gregory Clement <gregory.clement@free-electrons.com>,
	linux-leds@vger.kernel.org,
	Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Subject: Re: [RESEND PATCH 1/4] leds: leds-ns2: move LED modes mapping outside of the driver
Date: Wed, 24 Jun 2015 09:34:45 +0200	[thread overview]
Message-ID: <558A5D95.9040807@samsung.com> (raw)
In-Reply-To: <20150623181203.GE4853@kw.sim.vm.gnt>

Hi Simon,

On 06/23/2015 08:12 PM, Simon Guinot wrote:
[...]
>
>>> +	led = leds;
>>>   	for_each_child_of_node(np, child) {
>>>   		const char *string;
>>> -		int ret;
>>> +		int ret, i, num_modes;
>>> +		struct ns2_led_modval *modval;
>>>
>>>   		ret = of_get_named_gpio(child, "cmd-gpio", 0);
>>>   		if (ret < 0)
>>>   			return ret;
>>> -		leds[i].cmd = ret;
>>> +		led->cmd = ret;
>>>   		ret = of_get_named_gpio(child, "slow-gpio", 0);
>>>   		if (ret < 0)
>>>   			return ret;
>>> -		leds[i].slow = ret;
>>> +		led->slow = ret;
>>>   		ret = of_property_read_string(child, "label", &string);
>>> -		leds[i].name = (ret == 0) ? string : child->name;
>>> +		led->name = (ret == 0) ? string : child->name;
>>>   		ret = of_property_read_string(child, "linux,default-trigger",
>>>   					      &string);
>>>   		if (ret == 0)
>>> -			leds[i].default_trigger = string;
>>> +			led->default_trigger = string;
>>> +
>>> +		ret = of_property_count_u32_elems(child, "modes-map");
>>
>> I think that we shouldn't fail if the property is absent, but default
>> to the mapping that is currently hard coded in the driver. Otherwise
>> we would break existing users.
>
> I don't think there is a risk of breaking existing users. On platforms
> where the leds-ns2 driver is used, DTB will be updated with the kernel
> image. Moreover, removing the hard coded mapping is a nice clean-up.
>
> Let me know if you still want me to add a fallback.

Since you modify also dts file in this patch set this is OK.
You can keep this part as is.

-- 
Best Regards,
Jacek Anaszewski

WARNING: multiple messages have this Message-ID (diff)
From: j.anaszewski@samsung.com (Jacek Anaszewski)
To: linux-arm-kernel@lists.infradead.org
Subject: [RESEND PATCH 1/4] leds: leds-ns2: move LED modes mapping outside of the driver
Date: Wed, 24 Jun 2015 09:34:45 +0200	[thread overview]
Message-ID: <558A5D95.9040807@samsung.com> (raw)
In-Reply-To: <20150623181203.GE4853@kw.sim.vm.gnt>

Hi Simon,

On 06/23/2015 08:12 PM, Simon Guinot wrote:
[...]
>
>>> +	led = leds;
>>>   	for_each_child_of_node(np, child) {
>>>   		const char *string;
>>> -		int ret;
>>> +		int ret, i, num_modes;
>>> +		struct ns2_led_modval *modval;
>>>
>>>   		ret = of_get_named_gpio(child, "cmd-gpio", 0);
>>>   		if (ret < 0)
>>>   			return ret;
>>> -		leds[i].cmd = ret;
>>> +		led->cmd = ret;
>>>   		ret = of_get_named_gpio(child, "slow-gpio", 0);
>>>   		if (ret < 0)
>>>   			return ret;
>>> -		leds[i].slow = ret;
>>> +		led->slow = ret;
>>>   		ret = of_property_read_string(child, "label", &string);
>>> -		leds[i].name = (ret == 0) ? string : child->name;
>>> +		led->name = (ret == 0) ? string : child->name;
>>>   		ret = of_property_read_string(child, "linux,default-trigger",
>>>   					      &string);
>>>   		if (ret == 0)
>>> -			leds[i].default_trigger = string;
>>> +			led->default_trigger = string;
>>> +
>>> +		ret = of_property_count_u32_elems(child, "modes-map");
>>
>> I think that we shouldn't fail if the property is absent, but default
>> to the mapping that is currently hard coded in the driver. Otherwise
>> we would break existing users.
>
> I don't think there is a risk of breaking existing users. On platforms
> where the leds-ns2 driver is used, DTB will be updated with the kernel
> image. Moreover, removing the hard coded mapping is a nice clean-up.
>
> Let me know if you still want me to add a fallback.

Since you modify also dts file in this patch set this is OK.
You can keep this part as is.

-- 
Best Regards,
Jacek Anaszewski

  reply	other threads:[~2015-06-24  7:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-18 15:17 [RESEND PATCH 0/4] Allow to use leds-ns2 with n090401 boards Simon Guinot
2015-06-18 15:17 ` Simon Guinot
2015-06-18 15:17 ` [RESEND PATCH 1/4] leds: leds-ns2: move LED modes mapping outside of the driver Simon Guinot
2015-06-18 15:17   ` Simon Guinot
2015-06-22 14:32   ` Jacek Anaszewski
2015-06-22 14:32     ` Jacek Anaszewski
2015-06-23 18:12     ` Simon Guinot
2015-06-23 18:12       ` Simon Guinot
2015-06-24  7:34       ` Jacek Anaszewski [this message]
2015-06-24  7:34         ` Jacek Anaszewski
2015-06-18 15:17 ` [RESEND PATCH 2/4] ARM: Kirkwood: add modes-map property to ns2-leds nodes Simon Guinot
2015-06-18 15:17   ` Simon Guinot
2015-06-18 15:17 ` [RESEND PATCH 3/4] leds: leds-ns2: handle can_sleep GPIOs Simon Guinot
2015-06-18 15:17   ` Simon Guinot
2015-06-22 14:33   ` Jacek Anaszewski
2015-06-22 14:33     ` Jacek Anaszewski
2015-06-24 14:18   ` Jacek Anaszewski
2015-06-24 14:18     ` Jacek Anaszewski
2015-06-26 17:10     ` Simon Guinot
2015-06-26 17:10       ` Simon Guinot
2015-06-29 14:25       ` Jacek Anaszewski
2015-06-29 14:25         ` Jacek Anaszewski
2015-06-29 14:41         ` Simon Guinot
2015-06-29 14:41           ` Simon Guinot
2015-06-18 15:17 ` [RESEND PATCH 4/4] leds: leds-ns2: depends on MACH_ARMADA_370 Simon Guinot
2015-06-18 15:17   ` Simon Guinot
2015-06-22 14:33   ` Jacek Anaszewski
2015-06-22 14:33     ` Jacek Anaszewski

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=558A5D95.9040807@samsung.com \
    --to=j.anaszewski@samsung.com \
    --cc=andrew@lunn.ch \
    --cc=cooloney@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregory.clement@free-electrons.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=rpurdie@rpsys.net \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=simon.guinot@sequanux.org \
    --cc=vdonnefort@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.