2010-12-10 10:00:09

by Vasily Khoruzhick

[permalink] [raw]
Subject: [PATCH] LEDs: fix check for return value of blink_set callback

blink_set callback should return 0 on success, but check in
led-class.c is invalid. It results in software fallback even if
hw support is available.

Signed-off-by: Vasily Khoruzhick <[email protected]>
---
drivers/leds/led-class.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 211e21f..d5a4ade 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -267,7 +267,7 @@ 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))
return;

/* blink with 1 Hz as default if nothing specified */
--
1.7.3.2


2010-12-10 14:44:24

by Richard Purdie

[permalink] [raw]
Subject: Re: [PATCH] LEDs: fix check for return value of blink_set callback

On Fri, 2010-12-10 at 11:58 +0200, Vasily Khoruzhick wrote:
> blink_set callback should return 0 on success, but check in
> led-class.c is invalid. It results in software fallback even if
> hw support is available.
>
> Signed-off-by: Vasily Khoruzhick <[email protected]>

Acked-by: Richard Purdie <[email protected]>

> ---
> drivers/leds/led-class.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 211e21f..d5a4ade 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -267,7 +267,7 @@ 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))
> return;
>
> /* blink with 1 Hz as default if nothing specified */