lkml.org 
[lkml]   [2015]   [Feb]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] led/led-class: Handle LEDs with the same name
Hello Bryan

On Thu, Feb 19, 2015 at 8:12 PM, Bryan Wu <cooloney@gmail.com> wrote:
> Yes, this is what I want. It's good to let the user know there are
> multiple leds share the same name in DT. Sometime they made some
> mistake in the DTS file.

I have added that message now:

dev_info(parent, "Led %s renamed to %s due to name collision",
led_cdev->name, dev_name(led_cdev->dev));

>
> Please update the patch, we can start to discuss the implementation, then.
>
> Actually I think we don't need the temp_name and just use the "name".

We need to keep a pointer to the generated string, to release it later
with kfree.
Also I rather allocate new memory only if there is a name collision.

> And one more thing is device_find_child() will find child of the
> parent. But in your 2 PCI card case, these 2 parents are different
> then device_find_child() will return false twice even if your 2 red
> leds have the same name.

I am now iterating with

while (class_find_device(leds_class, NULL, name, match_name));


Thanks

--
Ricardo Ribalda


\
 
 \ /
  Last update: 2015-02-20 00:21    [W:0.117 / U:0.668 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site