public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Antonio Ospite <ospite@studenti.unina.it>
Cc: Richard Purdie <rpurdie@rpsys.net>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] leds: turn the blink_timer off before starting to blink
Date: Fri, 07 Oct 2011 09:39:25 +0200	[thread overview]
Message-ID: <1317973165.3988.3.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1317938611-4418-3-git-send-email-ospite@studenti.unina.it>

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


      reply	other threads:[~2011-10-07  7:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-06 22:03 [PATCH 0/2] leds: some issues with hardware blinking Antonio Ospite
2011-10-06 22:03 ` [PATCH 1/2] leds: save the delay values after a successful call to blink_set() Antonio Ospite
2011-10-07  7:38   ` Johannes Berg
2011-11-07 10:36     ` [PATCH] Revert "leds: save the delay values after a successful call to blink_set()" Johan Hovold
2011-11-16 21:21       ` Antonio Ospite
2011-11-18 19:06         ` Johan Hovold
2011-10-06 22:03 ` [PATCH 2/2] leds: turn the blink_timer off before starting to blink Antonio Ospite
2011-10-07  7:39   ` Johannes Berg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1317973165.3988.3.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ospite@studenti.unina.it \
    --cc=rpurdie@rpsys.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox