Renaming of devices in 2.6.31

Richard Purdie rpurdie at rpsys.net
Mon Nov 23 01:34:11 CET 2009


On Mon, 2009-11-23 at 00:48 +0100, Michael 'Mickey' Lauer wrote:
> Am Montag, den 23.11.2009, 00:23 +0100 schrieb Lars-Peter Clausen:
> > The naming spec for leds can be found at:
> > http://www.mjmwired.net/kernel/Documentation/leds-class.txt
> 
> Ok, I have read this. Twice to make sure I don't overlook anything.
> Nowhere does it says that on an UmbaUmba Phone the vibrator needs to be
> called UmbaUmba::vibrator. The line you are probably referring to is
> 
> "devicename:colour:function"
> 
> What 'devicename' reflects to is up to interpretation, in my opinion it
> does not mean the device as a whole (UmbaUmba Phone), but rather the
> peripheral device (FooBarCustomChip). As such, the same vibrator device
> can be found in gta01 and gta02, hence needs to have the same name.
> 
> Richard, excuse me for disturbing you, but we need some advice here. As
> the LED class maintainer, could you give your opinon on renaming those
> class devices? The thread starts w/
> http://lists.openmoko.org/pipermail/openmoko-kernel/2009-November/010717.html

Once devices have a name I generally advise people to stick with it.

The devicename is there simply so you can tell different LEDs apart. For
example, when you plug in a USB device with LEDs, you can tell them
apart from some other LEDs just by looking at the names (in that example
you can also look at the bus the device would be connected to). It also
helps me with bug reports :).

I'd expect that userspace is only ever interested in finding any
vibrator which it can easily do easily with a wildcard search
(/sys/class/leds/*:*:vibrator). Anyone encoding full device names in
their driver code probably shouldn't be. The location to look for these
things is fixed and the format well defined so there shouldn't be a
problem.

Note that the sysfs people hate me for this. They would want you to go
through each directory in /sys/class/leds/ opening
the /sys/class/leds/*/function file and reading it to find what you
want. So it could be much worse!

Cheers,

Richard






More information about the openmoko-kernel mailing list