diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 16:07:32 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-23 16:07:32 -0700 |
commit | ea541686d8454efac4f2b5c0767affb12d4b6a52 (patch) | |
tree | ef0812fcc3e07c067042add6388146b3485c793e /drivers/leds/led-class.c | |
parent | 0d876c6a96e2cabf8632e8066b617d9c2dec9518 (diff) | |
parent | 601a1b92ed3ce0025f7bec6fc591cceaef8d9d69 (diff) |
Merge branch 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds
* 'for-linus' of git://git.o-hand.com/linux-rpurdie-leds:
leds/acpi: Fix merge fallout from acpi_driver_data change
leds: Simplify logic in leds-ams-delta
leds: Fix trigger registration race
leds: Fix leds-class.c comment
leds: Add driver for HP harddisk protection LEDs
leds: leds-pca955x - Mark pca955x_led_set() static
leds: Remove uneeded leds-cm-x270 driver
leds: Remove uneeded strlen calls
leds: Add leds-wrap default-trigger
leds: Make default trigger fields const
leds: Add backlight LED trigger
leds: da903x: Add support for LEDs found on DA9030/DA9034
Diffstat (limited to 'drivers/leds/led-class.c')
-rw-r--r-- | drivers/leds/led-class.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index ee74ee7b2acc..6c4a326176d7 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -34,14 +34,11 @@ static ssize_t led_brightness_show(struct device *dev, struct device_attribute *attr, char *buf) { struct led_classdev *led_cdev = dev_get_drvdata(dev); - ssize_t ret = 0; /* no lock needed for this */ led_update_brightness(led_cdev); - sprintf(buf, "%u\n", led_cdev->brightness); - ret = strlen(buf) + 1; - return ret; + return sprintf(buf, "%u\n", led_cdev->brightness); } static ssize_t led_brightness_store(struct device *dev, @@ -113,6 +110,9 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) if (rc) goto err_out; +#ifdef CONFIG_LEDS_TRIGGERS + init_rwsem(&led_cdev->trigger_lock); +#endif /* add to the list of leds */ down_write(&leds_list_lock); list_add_tail(&led_cdev->node, &leds_list); @@ -121,8 +121,6 @@ int led_classdev_register(struct device *parent, struct led_classdev *led_cdev) led_update_brightness(led_cdev); #ifdef CONFIG_LEDS_TRIGGERS - init_rwsem(&led_cdev->trigger_lock); - rc = device_create_file(led_cdev->dev, &dev_attr_trigger); if (rc) goto err_out_led_list; @@ -147,7 +145,7 @@ err_out: EXPORT_SYMBOL_GPL(led_classdev_register); /** - * __led_classdev_unregister - unregisters a object of led_properties class. + * led_classdev_unregister - unregisters a object of led_properties class. * @led_cdev: the led device to unregister * * Unregisters a previously registered via led_classdev_register object. |