Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-19 Thread Ricardo Ribalda Delgado
Helo Josh On Fri, Feb 20, 2015 at 12:15 AM, Josh Cartwright wrote: > > Is this solvable by adding support for led properties in an aliases { } > node? I suppose that would mean you'd need to also overlay a selection > of which LED is "red", but I don't know if that is a problem. I think there a

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-19 Thread Josh Cartwright
On Tue, Feb 17, 2015 at 04:52:45PM -0800, Bryan Wu wrote: > On Tue, Feb 17, 2015 at 4:32 PM, Ricardo Ribalda Delgado [..] > > Then we have TWO gpios chip. Each of them have a led named red. When > > the second gpio-led is probed we have an error. Everything else > > (address offset, phandle, device

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-19 Thread Ricardo Ribalda Delgado
Hello Bryan On Thu, Feb 19, 2015 at 8:12 PM, Bryan Wu 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 d

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-19 Thread Bryan Wu
On Tue, Feb 17, 2015 at 10:55 PM, Ricardo Ribalda Delgado wrote: > Hi > > On Wed, Feb 18, 2015 at 2:36 AM, Bryan Wu wrote: > >>> >> >> I got it. In this case we need to give the leds device a unique name. >> Go back to your patch, you're adding 0, 1 at the end of the name of >> leds. It's better

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Ricardo Ribalda Delgado
Hi On Wed, Feb 18, 2015 at 2:36 AM, Bryan Wu wrote: >> > > I got it. In this case we need to give the leds device a unique name. > Go back to your patch, you're adding 0, 1 at the end of the name of > leds. It's better like GPIO I think you can pick up value of > leds device node and put it in

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Bryan Wu
> Thanks! On Tue, Feb 17, 2015 at 5:11 PM, Ricardo Ribalda Delgado wrote: > Hello Bryan > > On Wed, Feb 18, 2015 at 1:52 AM, Bryan Wu wrote: >>> >>> Lets say that we have a type of add-on card. Described by this DT >>> overlay (card.dtb): >>> >> >> I think who write this card.dtb should understa

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Ricardo Ribalda Delgado
Hello Bryan On Wed, Feb 18, 2015 at 1:52 AM, Bryan Wu wrote: >> >> Lets say that we have a type of add-on card. Described by this DT >> overlay (card.dtb): >> > > I think who write this card.dtb should understand this issue. And > choose the right name. card.dtb just describe the hardware in the

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Bryan Wu
On Tue, Feb 17, 2015 at 4:32 PM, Ricardo Ribalda Delgado wrote: > Hello Bryan > > On Wed, Feb 18, 2015 at 12:59 AM, Bryan Wu wrote: >> >> DT just describe the hardware, so if it's a different hardware, they >> should have different name. >> red0 for GPIO 0, red1 for GPIO 1 or choose other good na

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Ricardo Ribalda Delgado
Hello Bryan On Wed, Feb 18, 2015 at 12:59 AM, Bryan Wu wrote: > > DT just describe the hardware, so if it's a different hardware, they > should have different name. > red0 for GPIO 0, red1 for GPIO 1 or choose other good name instead of 0 and 1. I think I have not managed to explain myself prope

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Bryan Wu
On Tue, Feb 17, 2015 at 3:47 PM, Ricardo Ribalda Delgado wrote: > Hi > > On Wed, Feb 18, 2015 at 12:35 AM, Bryan Wu wrote: > >> So why not use name "red0" and name another one "red1"? since you have >> multiple different red leds here any way. > > I cannot control how many cameras the user will d

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Ricardo Ribalda Delgado
Hi On Wed, Feb 18, 2015 at 12:35 AM, Bryan Wu wrote: > So why not use name "red0" and name another one "red1"? since you have > multiple different red leds here any way. I cannot control how many cameras the user will decide to attach to the system, and if two similar cameras are attached to pc

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Bryan Wu
On Tue, Feb 17, 2015 at 2:54 PM, Ricardo Ribalda Delgado wrote: > Hello Bryan > > On Tue, Feb 17, 2015 at 11:34 PM, Bryan Wu wrote: >> >> Can you show me your device tree code for overlaying describing a camera? >> > > The camera is composed by fpga modules. The fpga is attached via pcie > to the

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Ricardo Ribalda Delgado
Hello Bryan On Tue, Feb 17, 2015 at 11:34 PM, Bryan Wu wrote: > > Can you show me your device tree code for overlaying describing a camera? > The camera is composed by fpga modules. The fpga is attached via pcie to the host. The whole dt would be too long. Here you can see the relevant parts

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-17 Thread Bryan Wu
On Thu, Feb 12, 2015 at 12:45 PM, Ricardo Ribalda Delgado wrote: > Hello Bryan > > On Thu, Feb 12, 2015 at 8:48 PM, Bryan Wu wrote: >> >> Could you please give me some real error message or example about this >> device tree overlays? Looks like it's not only for LED subsystem and >> how is it han

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-13 Thread Ricardo Ribalda Delgado
Hello Bryan This is a real error message: [6.335055] [ cut here ] [6.335089] WARNING: CPU: 1 PID: 74 at fs/sysfs/dir.c:31 sysfs_warn_dup+0x68/0x80() [6.335100] sysfs: cannot create duplicate filename '/devices/pci:00/:00:05.0/:01:00.0/b004.leds/

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-12 Thread Ricardo Ribalda Delgado
Hello Bryan On Thu, Feb 12, 2015 at 8:48 PM, Bryan Wu wrote: > > Could you please give me some real error message or example about this > device tree overlays? Looks like it's not only for LED subsystem and > how is it handled in other subsystem? In my case I have a device tree overlay describin

Re: [PATCH] led/led-class: Handle LEDs with the same name

2015-02-12 Thread Bryan Wu
On Wed, Feb 11, 2015 at 4:26 AM, Ricardo Ribalda Delgado wrote: > The current code expected that every LED had an unique name. This is a > legit expectation when the device tree can no be modified or extended. > But with device tree overlays this requirement can be easily broken. > Could you plea

[PATCH] led/led-class: Handle LEDs with the same name

2015-02-11 Thread Ricardo Ribalda Delgado
The current code expected that every LED had an unique name. This is a legit expectation when the device tree can no be modified or extended. But with device tree overlays this requirement can be easily broken. This patch finds out if the name is already in use and adds the suffix _1, _2... if not