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 1/2] leds: save the delay values after a successful call to blink_set()
From
Date
On Thu, 2011-10-06 at 22:03 +0000, Antonio Ospite wrote:
> When calling the hardware blinking function implemented by blink_set(),
> the delay_on and delay_off values are not preserved across calls.
>
> Fix that and make the "timer" trigger work as expected when hardware
> blinking is available.
>
> BEFORE the fix:
> $ cd /sys/class/leds/someled
> $ echo timer > trigger
> $ cat delay_on delay_off
> 0
> 0
> $ echo 100 > delay_on
> $ cat delay_on delay_off
> 0
> 0
> $ echo 100 > delay_off
> $ cat delay_on delay_off
> 0
> 0
>
> AFTER the fix:
> $ cd /sys/class/leds/someled
> $ echo timer > trigger
> $ cat delay_on delay_off
> 0
> 0
> $ echo 100 > delay_on
> $ cat delay_on delay_off
> 100
> 0
> $ echo 100 > delay_off
> $ cat delay_on delay_off
> 100
> 100
>
> Signed-off-by: Antonio Ospite <ospite@studenti.unina.it>
> ---
> drivers/leds/led-class.c | 5 ++++-
> 1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index d5a4ade..939f24a 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -267,8 +267,11 @@ void led_blink_set(struct led_classdev *led_cdev,
> unsigned long *delay_off)
> {
> if (led_cdev->blink_set &&
> - !led_cdev->blink_set(led_cdev, delay_on, delay_off))
> + !led_cdev->blink_set(led_cdev, delay_on, delay_off)) {
> + led_cdev->blink_delay_on = *delay_on;
> + led_cdev->blink_delay_off = *delay_off;
> return;
> + }

Looks good to me. I suspect I created this bug because originally it
might have put the values into there first and then called blink_set().

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

johannes

--------------------------------------------------------------------------------------
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Douglas Lusk, Peter Gleissner, Hannes Schwaderer
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052
\
 
 \ /
  Last update: 2011-10-07 09:41    [W:0.063 / U:3.592 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site