diff options
author | Antonio Ospite <ospite@studenti.unina.it> | 2011-10-31 20:12:22 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-10-31 20:30:55 -0400 |
commit | 488bc35bf40df89d37486c1826b178a2fba36ce7 (patch) | |
tree | 68c665e8b0387b0abbb3c381f3e5ee7293a79f44 | |
parent | 6123b0e274503a0d3588e84fbe07c9aa01bfaf5d (diff) |
leds: turn the blink_timer off before starting to blink
Depending on the implementation of the hardware blinking function in
blink_set(), the led can support hardware blinking for some values of
delay_on and delay_off and fall-back to software blinking for some other
values.
Turning off the blink_timer unconditionally before starting to blink
make sure that a sequence like:
OFF
hardware blinking
software blinking
hardware blinking
does not leave the software blinking timer active.
Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Richard Purdie <rpurdie@rpsys.net>
Cc: <stable@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/leds/led-class.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 5c270aecedc5..661b692573e7 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c | |||
@@ -267,6 +267,8 @@ void led_blink_set(struct led_classdev *led_cdev, | |||
267 | unsigned long *delay_on, | 267 | unsigned long *delay_on, |
268 | unsigned long *delay_off) | 268 | unsigned long *delay_off) |
269 | { | 269 | { |
270 | del_timer_sync(&led_cdev->blink_timer); | ||
271 | |||
270 | if (led_cdev->blink_set && | 272 | if (led_cdev->blink_set && |
271 | !led_cdev->blink_set(led_cdev, delay_on, delay_off)) { | 273 | !led_cdev->blink_set(led_cdev, delay_on, delay_off)) { |
272 | led_cdev->blink_delay_on = *delay_on; | 274 | led_cdev->blink_delay_on = *delay_on; |