diff options
author | Németh Márton <nm127@freemail.hu> | 2008-03-09 16:54:37 -0400 |
---|---|---|
committer | Richard Purdie <rpurdie@rpsys.net> | 2008-04-24 18:34:18 -0400 |
commit | 0013b23d66a2768f5babbb0ea9f03ab067a990d8 (patch) | |
tree | 14d60a50bb68e422767a268cd737f70ef4e6e19d /drivers/leds/led-triggers.c | |
parent | b3ba31f84ea041c0945b5904d4c407ce14b2b72c (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.c | 12 |
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 | ||
140 | void 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 | |||
142 | void led_trigger_set_default(struct led_classdev *led_cdev) | 147 | void 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 */ |
233 | EXPORT_SYMBOL_GPL(led_trigger_set); | 238 | EXPORT_SYMBOL_GPL(led_trigger_set); |
239 | EXPORT_SYMBOL_GPL(led_trigger_remove); | ||
234 | EXPORT_SYMBOL_GPL(led_trigger_set_default); | 240 | EXPORT_SYMBOL_GPL(led_trigger_set_default); |
235 | EXPORT_SYMBOL_GPL(led_trigger_show); | 241 | EXPORT_SYMBOL_GPL(led_trigger_show); |
236 | EXPORT_SYMBOL_GPL(led_trigger_store); | 242 | EXPORT_SYMBOL_GPL(led_trigger_store); |