leds: Fix race between LED device uevent and actual attributes creation
authorFlorian Fainelli <ffainelli@freebox.fr>
Wed, 10 Mar 2010 17:32:18 +0000 (18:32 +0100)
committerRichard Purdie <rpurdie@linux.intel.com>
Tue, 16 Mar 2010 20:27:25 +0000 (20:27 +0000)
commit14b5d6dd40b3091cb5f566568baa4a74dc619286
treea7373270c8a0c90e03addbd1df7f3d849f8a7e52
parent0493a4ff10959ff4c8e0d65efee25b7ffd4fa5db
leds: Fix race between LED device uevent and actual attributes creation

If we were to dynamically register/unregister leds and have udev or other
daemons handle the leds class uevents, we would be notified of the adding of a
new LED and if the daemon immediately tries to open one of the attributes of
the led device, it would fail with a "no such file or directory" error since
this the attributes are not yet created. Fix this by switching attributes to be
class-wide, such that the driver core will register these attributes with
device_add_attrs and then emit the kobject_uevent ADD signal.

Signed-off-by: Fainelli <ffainelli@freebox.fr>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
drivers/leds/led-class.c