All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DT: leds: Add uniqueness requirement for 'label' property.
@ 2015-03-26 14:03 Jacek Anaszewski
  2015-03-26 14:03 ` [PATCH] leds: start numerating duplicated devices from 2 Jacek Anaszewski
  2015-03-26 20:59 ` [PATCH] DT: leds: Add uniqueness requirement for 'label' property Sakari Ailus
  0 siblings, 2 replies; 7+ messages in thread
From: Jacek Anaszewski @ 2015-03-26 14:03 UTC (permalink / raw)
  To: linux-leds
  Cc: Jacek Anaszewski, Bryan Wu, Richard Purdie, Sakari Ailus, devicetree

Label is used for naming LED class devices. Since ePAPR
doesn't require uniqueness for label properties, it has to be
explicitly required in the LEDs common bindings documentation.

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Bryan Wu <cooloney@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Sakari Ailus <sakari.ailus@iki.fi>
Cc: devicetree@vger.kernel.org
---
 Documentation/devicetree/bindings/leds/common.txt |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/leds/common.txt b/Documentation/devicetree/bindings/leds/common.txt
index 34811c5..747c538 100644
--- a/Documentation/devicetree/bindings/leds/common.txt
+++ b/Documentation/devicetree/bindings/leds/common.txt
@@ -14,8 +14,10 @@ Optional properties for child nodes:
 - led-sources : List of device current outputs the LED is connected to. The
 		outputs are identified by the numbers that must be defined
 		in the LED device binding documentation.
-- label : The label for this LED.  If omitted, the label is
-  taken from the node name (excluding the unit address).
+- label : The label for this LED. If omitted, the label is taken from the node
+	  name (excluding the unit address). It has to uniquely identify
+	  a device, i.e. no other LED class device can be assigned the same
+	  label.
 
 - linux,default-trigger :  This parameter, if present, is a
     string defining the trigger assigned to the LED.  Current triggers are:
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH] leds: start numerating duplicated devices from 2
  2015-03-26 14:03 [PATCH] DT: leds: Add uniqueness requirement for 'label' property Jacek Anaszewski
@ 2015-03-26 14:03 ` Jacek Anaszewski
  2015-03-26 14:22   ` Ricardo Ribalda Delgado
  2015-03-26 20:59 ` [PATCH] DT: leds: Add uniqueness requirement for 'label' property Sakari Ailus
  1 sibling, 1 reply; 7+ messages in thread
From: Jacek Anaszewski @ 2015-03-26 14:03 UTC (permalink / raw)
  To: linux-leds
  Cc: Jacek Anaszewski, Bryan Wu, Richard Purdie,
	Ricardo Ribalda Delgado, Sakari Ailus

Duplicated devices are currently given numerical suffixes
starting from 1. Since duplication means that one instance
of a device already exists in the system, then it is more
intuitive for the next device to get the suffix "_2".

Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Bryan Wu <cooloney@gmail.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Cc: Sakari Ailus <sakari.ailus@iki.fi>
---
 drivers/leds/led-class.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 4ca37b8..d4973fd 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -222,7 +222,7 @@ static int match_name(struct device *dev, const void *data)
 static int led_classdev_next_name(const char *init_name, char *name,
 				  size_t len)
 {
-	int i = 0;
+	int i = 1;
 
 	strncpy(name, init_name, len);
 
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] leds: start numerating duplicated devices from 2
  2015-03-26 14:03 ` [PATCH] leds: start numerating duplicated devices from 2 Jacek Anaszewski
@ 2015-03-26 14:22   ` Ricardo Ribalda Delgado
  2015-03-26 14:39     ` Jacek Anaszewski
  0 siblings, 1 reply; 7+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-03-26 14:22 UTC (permalink / raw)
  To: Jacek Anaszewski
  Cc: Linux LED Subsystem, Bryan Wu, Richard Purdie, Sakari Ailus

Hello

I thought real programmers count from zero :), Jokes aside, I think it
is the convention in the kernel to start from 0 (video0, mmc0....)

Also the patch is wrong, it will always show the info message "led
renamed to...", becase led_classdev_register expects 0 when the device
has not been renamed, with this patch you will return 1.

Best Regards

Nacked-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>

-- 
Ricardo Ribalda

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] leds: start numerating duplicated devices from 2
  2015-03-26 14:22   ` Ricardo Ribalda Delgado
@ 2015-03-26 14:39     ` Jacek Anaszewski
  2015-03-26 14:43       ` Ricardo Ribalda Delgado
  0 siblings, 1 reply; 7+ messages in thread
From: Jacek Anaszewski @ 2015-03-26 14:39 UTC (permalink / raw)
  To: Ricardo Ribalda Delgado
  Cc: Linux LED Subsystem, Bryan Wu, Richard Purdie, Sakari Ailus

Hi Ricardo,

On 03/26/2015 03:22 PM, Ricardo Ribalda Delgado wrote:
> Hello
>
> I thought real programmers count from zero :), Jokes aside, I think it
> is the convention in the kernel to start from 0 (video0, mmc0....)
>
> Also the patch is wrong, it will always show the info message "led
> renamed to...", becase led_classdev_register expects 0 when the device
> has not been renamed, with this patch you will return 1.
>
> Best Regards
>
> Nacked-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
>

Oops, I didn't notice this :-/

Getting back to numeration - in the LED subsystem devices don't
get numerical suffixes, if they are not duplicated.

For V4L2 case every device name begins from 'video' so adding
the numbers from 0 is reasonable.

For LED subsystem having devices e.g. aat1290 and aat1290_1 would
be confusing IMO.


-- 
Best Regards,
Jacek Anaszewski

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] leds: start numerating duplicated devices from 2
  2015-03-26 14:39     ` Jacek Anaszewski
@ 2015-03-26 14:43       ` Ricardo Ribalda Delgado
  0 siblings, 0 replies; 7+ messages in thread
From: Ricardo Ribalda Delgado @ 2015-03-26 14:43 UTC (permalink / raw)
  To: Jacek Anaszewski
  Cc: Linux LED Subsystem, Bryan Wu, Richard Purdie, Sakari Ailus

Hi Jacek

On Thu, Mar 26, 2015 at 3:39 PM, Jacek Anaszewski
<j.anaszewski@samsung.com> wrote:

>
> For LED subsystem having devices e.g. aat1290 and aat1290_1 would
> be confusing IMO.

It the error is fixed I have no strong opinion here. I prefer from _1,
but if the consensus is different I would not object.

Send a v2 of the patch, and lets see what Bryan has to say :)

Regards!

>
>
> --
> Best Regards,
> Jacek Anaszewski



-- 
Ricardo Ribalda

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] DT: leds: Add uniqueness requirement for 'label' property.
  2015-03-26 14:03 [PATCH] DT: leds: Add uniqueness requirement for 'label' property Jacek Anaszewski
  2015-03-26 14:03 ` [PATCH] leds: start numerating duplicated devices from 2 Jacek Anaszewski
@ 2015-03-26 20:59 ` Sakari Ailus
  2015-03-27  0:58   ` Bryan Wu
  1 sibling, 1 reply; 7+ messages in thread
From: Sakari Ailus @ 2015-03-26 20:59 UTC (permalink / raw)
  To: Jacek Anaszewski, linux-leds; +Cc: Bryan Wu, Richard Purdie, devicetree

Hi Jacek,

Jacek Anaszewski wrote:
> Label is used for naming LED class devices. Since ePAPR
> doesn't require uniqueness for label properties, it has to be
> explicitly required in the LEDs common bindings documentation.
> 
> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Bryan Wu <cooloney@gmail.com>
> Cc: Richard Purdie <rpurdie@rpsys.net>
> Cc: Sakari Ailus <sakari.ailus@iki.fi>
> Cc: devicetree@vger.kernel.org

Thanks for the patch!

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus
sakari.ailus@iki.fi

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] DT: leds: Add uniqueness requirement for 'label' property.
  2015-03-26 20:59 ` [PATCH] DT: leds: Add uniqueness requirement for 'label' property Sakari Ailus
@ 2015-03-27  0:58   ` Bryan Wu
  0 siblings, 0 replies; 7+ messages in thread
From: Bryan Wu @ 2015-03-27  0:58 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: Jacek Anaszewski, Linux LED Subsystem, Richard Purdie, devicetree

On Thu, Mar 26, 2015 at 1:59 PM, Sakari Ailus <sakari.ailus@iki.fi> wrote:
> Hi Jacek,
>
> Jacek Anaszewski wrote:
>> Label is used for naming LED class devices. Since ePAPR
>> doesn't require uniqueness for label properties, it has to be
>> explicitly required in the LEDs common bindings documentation.
>>
>> Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
>> Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
>> Cc: Bryan Wu <cooloney@gmail.com>
>> Cc: Richard Purdie <rpurdie@rpsys.net>
>> Cc: Sakari Ailus <sakari.ailus@iki.fi>
>> Cc: devicetree@vger.kernel.org
>
> Thanks for the patch!
>
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
Looks good to me, I will merge it.

-Bryan

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-03-27  0:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-26 14:03 [PATCH] DT: leds: Add uniqueness requirement for 'label' property Jacek Anaszewski
2015-03-26 14:03 ` [PATCH] leds: start numerating duplicated devices from 2 Jacek Anaszewski
2015-03-26 14:22   ` Ricardo Ribalda Delgado
2015-03-26 14:39     ` Jacek Anaszewski
2015-03-26 14:43       ` Ricardo Ribalda Delgado
2015-03-26 20:59 ` [PATCH] DT: leds: Add uniqueness requirement for 'label' property Sakari Ailus
2015-03-27  0:58   ` Bryan Wu

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.