lkml.org 
[lkml]   [2011]   [Oct]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH 2/2] leds: turn the blink_timer off before starting to blink
From
Date
On Thu, 2011-10-06 at 22:03 +0000, Antonio Ospite wrote:
> 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>
> ---
> 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;

Makes sense, good catch!

Reviewed-by: Johannes Berg <johannes@sipsolutions.net>

johannes


\
 
 \ /
  Last update: 2011-10-07 09:41    [W:0.051 / U:0.420 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site