* [PATCH] leds: Don't allow brightness values greater than max_brightness
@ 2014-12-23 18:59 Gabriele Mazzotta
2014-12-23 19:02 ` Bryan Wu
0 siblings, 1 reply; 2+ messages in thread
From: Gabriele Mazzotta @ 2014-12-23 18:59 UTC (permalink / raw)
To: cooloney, rpurdie
Cc: linux-leds, linux-kernel, j.anaszewski, kyungmin.park, Gabriele Mazzotta
Since commit 4d71a4a12b13 ("leds: Add support for setting brightness in
a synchronous way") the value passed to brightness_set() is no longer
limited to max_brightness and can be different from the internally saved
brightness value.
Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
---
drivers/leds/leds.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
index 2348dbd..79efe57 100644
--- a/drivers/leds/leds.h
+++ b/drivers/leds/leds.h
@@ -20,7 +20,8 @@
static inline void led_set_brightness_async(struct led_classdev *led_cdev,
enum led_brightness value)
{
- led_cdev->brightness = min(value, led_cdev->max_brightness);
+ value = min(value, led_cdev->max_brightness);
+ led_cdev->brightness = value;
if (!(led_cdev->flags & LED_SUSPENDED))
led_cdev->brightness_set(led_cdev, value);
--
2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] leds: Don't allow brightness values greater than max_brightness
2014-12-23 18:59 [PATCH] leds: Don't allow brightness values greater than max_brightness Gabriele Mazzotta
@ 2014-12-23 19:02 ` Bryan Wu
0 siblings, 0 replies; 2+ messages in thread
From: Bryan Wu @ 2014-12-23 19:02 UTC (permalink / raw)
To: Gabriele Mazzotta
Cc: rpurdie, Linux LED Subsystem, lkml, Jacek Anaszewski, Kyungmin Park
On Tue, Dec 23, 2014 at 10:59 AM, Gabriele Mazzotta
<gabriele.mzt@gmail.com> wrote:
> Since commit 4d71a4a12b13 ("leds: Add support for setting brightness in
> a synchronous way") the value passed to brightness_set() is no longer
> limited to max_brightness and can be different from the internally saved
> brightness value.
>
Good catch, I will merge this soon.
Thanks,
-Bryan
> Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
> ---
> drivers/leds/leds.h | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/leds/leds.h b/drivers/leds/leds.h
> index 2348dbd..79efe57 100644
> --- a/drivers/leds/leds.h
> +++ b/drivers/leds/leds.h
> @@ -20,7 +20,8 @@
> static inline void led_set_brightness_async(struct led_classdev *led_cdev,
> enum led_brightness value)
> {
> - led_cdev->brightness = min(value, led_cdev->max_brightness);
> + value = min(value, led_cdev->max_brightness);
> + led_cdev->brightness = value;
>
> if (!(led_cdev->flags & LED_SUSPENDED))
> led_cdev->brightness_set(led_cdev, value);
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-12-23 19:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-23 18:59 [PATCH] leds: Don't allow brightness values greater than max_brightness Gabriele Mazzotta
2014-12-23 19:02 ` Bryan Wu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®