[047/264] leds: turn the blink_timer off before starting to blink

From: Greg KH
Date: Wed Nov 09 2011 - 22:37:15 EST


3.1-stable review patch. If anyone has any objections, please let me know.

------------------

From: Antonio Ospite <ospite@xxxxxxxxxxxxxxxxx>

commit 488bc35bf40df89d37486c1826b178a2fba36ce7 upstream.

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@xxxxxxxxxxxxxxxxx>
Reviewed-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx>
Cc: Richard Purdie <rpurdie@xxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/leds/led-class.c | 2 ++
1 file changed, 2 insertions(+)

--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -267,6 +267,8 @@ void led_blink_set(struct led_classdev *
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/