From: Gabriele Mazzotta <gabriele.mzt@gmail.com>
To: cooloney@gmail.com, rpurdie@rpsys.net
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
j.anaszewski@samsung.com, kyungmin.park@samsung.com,
Gabriele Mazzotta <gabriele.mzt@gmail.com>
Subject: [PATCH] leds: Don't allow brightness values greater than max_brightness
Date: Tue, 23 Dec 2014 19:59:23 +0100 [thread overview]
Message-ID: <1419361163-4762-1-git-send-email-gabriele.mzt@gmail.com> (raw)
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
next reply other threads:[~2014-12-23 18:59 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-23 18:59 Gabriele Mazzotta [this message]
2014-12-23 19:02 ` Bryan Wu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1419361163-4762-1-git-send-email-gabriele.mzt@gmail.com \
--to=gabriele.mzt@gmail.com \
--cc=cooloney@gmail.com \
--cc=j.anaszewski@samsung.com \
--cc=kyungmin.park@samsung.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=rpurdie@rpsys.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®