Messages in this thread |  | | From | Ricardo Ribalda Delgado <> | Date | Thu, 19 Feb 2015 23:59:57 +0100 | Subject | Re: [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
|  |