diff options
author | Antonio Ospite <ospite@studenti.unina.it> | 2011-10-31 17:12:19 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-11-11 09:42:34 -0800 |
commit | d25cfa5af43cdcf1f5135f3f4dcae9ed5e965509 (patch) | |
tree | 0af5a4f49137e124fd552a6feeea2de90bf85302 /drivers/leds/led-class.c | |
parent | cc1548ae4462033f00b72bff3dbb16f5a3e54f6c (diff) |
leds: save the delay values after a successful call to blink_set()
commit 6123b0e274503a0d3588e84fbe07c9aa01bfaf5d upstream.
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>
Reviewed-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/leds/led-class.c')
-rw-r--r-- | 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 dc3d3d83191a..5c270aecedc5 100644 --- a/drivers/leds/led-class.c +++ b/drivers/leds/led-class.c @@ -268,8 +268,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; + } /* blink with 1 Hz as default if nothing specified */ if (!*delay_on && !*delay_off) |