aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/led-triggers.c
diff options
context:
space:
mode:
authorNémeth Márton <nm127@freemail.hu>2008-03-09 20:54:37 +0000
committerRichard Purdie <rpurdie@rpsys.net>2008-04-24 23:34:18 +0100
commit0013b23d66a2768f5babbb0ea9f03ab067a990d8 (patch)
tree14d60a50bb68e422767a268cd737f70ef4e6e19d /drivers/leds/led-triggers.c
parentb3ba31f84ea041c0945b5904d4c407ce14b2b72c (diff)
downloadkernel_goldelico_gta04-0013b23d66a2768f5babbb0ea9f03ab067a990d8.zip
kernel_goldelico_gta04-0013b23d66a2768f5babbb0ea9f03ab067a990d8.tar.gz
kernel_goldelico_gta04-0013b23d66a2768f5babbb0ea9f03ab067a990d8.tar.bz2
leds: disable triggers on brightness set
Disable any active triggers when the brightness attribute is set to zero. Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br> Signed-off-by: Márton Németh <nm127@freemail.hu> Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Diffstat (limited to 'drivers/leds/led-triggers.c')
-rw-r--r--drivers/leds/led-triggers.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/leds/led-triggers.c b/drivers/leds/led-triggers.c
index 13c9026..21dd969 100644
--- a/drivers/leds/led-triggers.c
+++ b/drivers/leds/led-triggers.c
@@ -45,9 +45,7 @@ ssize_t led_trigger_store(struct device *dev, struct device_attribute *attr,
trigger_name[len - 1] = '\0';
if (!strcmp(trigger_name, "none")) {
- down_write(&led_cdev->trigger_lock);
- led_trigger_set(led_cdev, NULL);
- up_write(&led_cdev->trigger_lock);
+ led_trigger_remove(led_cdev);
return count;
}
@@ -139,6 +137,13 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger)
led_cdev->trigger = trigger;
}
+void led_trigger_remove(struct led_classdev *led_cdev)
+{
+ down_write(&led_cdev->trigger_lock);
+ led_trigger_set(led_cdev, NULL);
+ up_write(&led_cdev->trigger_lock);
+}
+
void led_trigger_set_default(struct led_classdev *led_cdev)
{
struct led_trigger *trig;
@@ -231,6 +236,7 @@ void led_trigger_unregister_simple(struct led_trigger *trigger)
/* Used by LED Class */
EXPORT_SYMBOL_GPL(led_trigger_set);
+EXPORT_SYMBOL_GPL(led_trigger_remove);
EXPORT_SYMBOL_GPL(led_trigger_set_default);
EXPORT_SYMBOL_GPL(led_trigger_show);
EXPORT_SYMBOL_GPL(led_trigger_store);