From 488bc35bf40df89d37486c1826b178a2fba36ce7 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Mon, 31 Oct 2011 17:12:22 -0700 Subject: [PATCH] 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 Reviewed-by: Johannes Berg Cc: Richard Purdie Cc: Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/leds/led-class.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c index 5c270aecedc..661b692573e 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, unsigned long *delay_on, unsigned long *delay_off) { + del_timer_sync(&led_cdev->blink_timer); + if (led_cdev->blink_set && !led_cdev->blink_set(led_cdev, delay_on, delay_off)) { led_cdev->blink_delay_on = *delay_on; -- 2.20.1