[PATCH 2/2] leds: turn the blink_timer off before starting to blink

From: Antonio Ospite
Date: Thu Oct 06 2011 - 18:04:17 EST

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

Turning off the blink_timer unconditionally before starting to blink
make sure that a sequence like:

hardware blinking
software blinking
hardware blinking

does not leave the software blinking timer active.

Signed-off-by: Antonio Ospite <ospite@xxxxxxxxxxxxxxxxx>
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 939f24a..a7f0b29 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -266,6 +266,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;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/