aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/led-triggers.c
diff options
context:
space:
mode:
authorNémeth Márton <nm127@freemail.hu>2008-03-09 16:54:37 -0400
committerRichard Purdie <rpurdie@rpsys.net>2008-04-24 18:34:18 -0400
commit0013b23d66a2768f5babbb0ea9f03ab067a990d8 (patch)
tree14d60a50bb68e422767a268cd737f70ef4e6e19d /drivers/leds/led-triggers.c
parentb3ba31f84ea041c0945b5904d4c407ce14b2b72c (diff)
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 13c9026d68af..21dd96909444 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,
45 trigger_name[len - 1] = '\0'; 45 trigger_name[len - 1] = '\0';
46 46
47 if (!strcmp(trigger_name, "none")) { 47 if (!strcmp(trigger_name, "none")) {
48 down_write(&led_cdev->trigger_lock); 48 led_trigger_remove(led_cdev);
49 led_trigger_set(led_cdev, NULL);
50 up_write(&led_cdev->trigger_lock);
51 return count; 49 return count;
52 } 50 }
53 51
@@ -139,6 +137,13 @@ void led_trigger_set(struct led_classdev *led_cdev, struct led_trigger *trigger)
139 led_cdev->trigger = trigger; 137 led_cdev->trigger = trigger;
140} 138}
141 139
140void led_trigger_remove(struct led_classdev *led_cdev)
141{
142 down_write(&led_cdev->trigger_lock);
143 led_trigger_set(led_cdev, NULL);
144 up_write(&led_cdev->trigger_lock);
145}
146
142void led_trigger_set_default(struct led_classdev *led_cdev) 147void led_trigger_set_default(struct led_classdev *led_cdev)
143{ 148{
144 struct led_trigger *trig; 149 struct led_trigger *trig;
@@ -231,6 +236,7 @@ void led_trigger_unregister_simple(struct led_trigger *trigger)
231 236
232/* Used by LED Class */ 237/* Used by LED Class */
233EXPORT_SYMBOL_GPL(led_trigger_set); 238EXPORT_SYMBOL_GPL(led_trigger_set);
239EXPORT_SYMBOL_GPL(led_trigger_remove);
234EXPORT_SYMBOL_GPL(led_trigger_set_default); 240EXPORT_SYMBOL_GPL(led_trigger_set_default);
235EXPORT_SYMBOL_GPL(led_trigger_show); 241EXPORT_SYMBOL_GPL(led_trigger_show);
236EXPORT_SYMBOL_GPL(led_trigger_store); 242EXPORT_SYMBOL_GPL(led_trigger_store);