leds: Turn off led if blinking is disabled
authorStefan Sørensen <stefan.sorensen@spectralink.com>
Tue, 4 Feb 2014 08:11:42 +0000 (00:11 -0800)
committerBryan Wu <cooloney@gmail.com>
Thu, 27 Feb 2014 17:56:55 +0000 (09:56 -0800)
When using the timer trigger and setting delay_on to 0, the led
will stay in whatever state is was in, while intuitively one
would expect it to turn off. This patch changes the behaviour to
turn it off.

Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
drivers/leds/led-core.c

index ce8921a753a32107b30915f8c2ae2b837310d33d..71b40d3bf77604e32829f391b6e804bbeefb0cf1 100644 (file)
@@ -39,9 +39,11 @@ static void led_set_software_blink(struct led_classdev *led_cdev,
        led_cdev->blink_delay_on = delay_on;
        led_cdev->blink_delay_off = delay_off;
 
-       /* never on - don't blink */
-       if (!delay_on)
+       /* never on - just set to off */
+       if (!delay_on) {
+               __led_set_brightness(led_cdev, LED_OFF);
                return;
+       }
 
        /* never off - just set to brightness */
        if (!delay_off) {