Brightness control irrespective of blink state.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi All,
Is there a reason for rejecting brightness change requests when either of the blink_delays are set? Shouldn't the function be allowed to call "led_set_brightness_sync"?

I am referring to "led_set_brightness" in led-core.c.

With the following change, the brightness of led can be varied irrespective of blinking state. But wanted to check if that is a bad idea?

Many Thanks,
Tony


--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -190,7 +191,15 @@ EXPORT_SYMBOL_GPL(led_stop_software_blink);
 void led_set_brightness(struct led_classdev *led_cdev,
                        enum led_brightness brightness)
 {
-       int ret = 0;
+       int ret = -EINVAL;
+
+       if (led_cdev->flags & SET_BRIGHTNESS_SYNC){
+               ret = led_set_brightness_sync(led_cdev, brightness);
+               if (ret < 0)
+                       dev_dbg(led_cdev->dev,
+ "Setting LED brightness failed (%d)\n", ret);
+               return;
+       }

        /* delay brightness if soft-blink is active */
        if (led_cdev->blink_delay_on || led_cdev->blink_delay_off) {
@@ -203,14 +212,8 @@ void led_set_brightness(struct led_classdev *led_cdev,
        if (led_cdev->flags & SET_BRIGHTNESS_ASYNC) {
                led_set_brightness_async(led_cdev, brightness);
                return;
-       } else if (led_cdev->flags & SET_BRIGHTNESS_SYNC)
-               ret = led_set_brightness_sync(led_cdev, brightness);
-       else
-               ret = -EINVAL;
-
-       if (ret < 0)
- dev_dbg(led_cdev->dev, "Setting LED brightness failed (%d)\n",
-                       ret);
+       }
+       dev_dbg(led_cdev->dev, "Setting LED brightness failed (%d)\n", ret);
 }
 EXPORT_SYMBOL(led_set_brightness);
--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux