From: Fabio Baltieri <fabio.baltieri@gmail.com>
To: Bryan Wu <bryan.wu@canonical.com>
Cc: linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org,
Richard Purdie <rpurdie@rpsys.net>,
Fabio Baltieri <fabio.baltieri@gmail.com>
Subject: [PATCH 2/2] leds: fix led_brightness_set when soft-blinking
Date: Tue, 5 Jun 2012 23:38:59 +0200 [thread overview]
Message-ID: <1338932339-1660-2-git-send-email-fabio.baltieri@gmail.com> (raw)
In-Reply-To: <1338932339-1660-1-git-send-email-fabio.baltieri@gmail.com>
Change led_brightness_set to ensure software blink timer is stopped
before calling led_stop_software_blink() and use led_set_brightness()
instead of calling led_cdev->brightness_set() directly to ensure
led_cdev->brightness is always consistent with current LED status.
This ensure proper cleaning when changing triggers, as without this fix
a LED may be turned off while leaving it's led_cdev->brightness = 1,
leading to an erratic software-blink behaviour.
The problem was easy to reproduce by changing the trigger from "timer"
to "oneshot".
Signed-off-by: Fabio Baltieri <fabio.baltieri@gmail.com>
Cc: Bryan Wu <bryan.wu@canonical.com>
---
drivers/leds/led-core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/leds/led-core.c b/drivers/leds/led-core.c
index 579eb78..3e9f934 100644
--- a/drivers/leds/led-core.c
+++ b/drivers/leds/led-core.c
@@ -115,7 +115,8 @@ EXPORT_SYMBOL(led_blink_set_oneshot);
void led_brightness_set(struct led_classdev *led_cdev,
enum led_brightness brightness)
{
+ del_timer_sync(&led_cdev->blink_timer);
led_stop_software_blink(led_cdev);
- led_cdev->brightness_set(led_cdev, brightness);
+ led_set_brightness(led_cdev, brightness);
}
EXPORT_SYMBOL(led_brightness_set);
--
1.7.10.2.520.g6a4a482.dirty
next prev parent reply other threads:[~2012-06-05 21:37 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-05 21:38 [PATCH v2 1/2] led: add oneshot trigger Fabio Baltieri
2012-06-05 21:38 ` Fabio Baltieri [this message]
2012-06-06 3:58 ` [PATCH 2/2] leds: fix led_brightness_set when soft-blinking Bryan Wu
2012-06-06 7:00 ` Fabio Baltieri
2012-06-06 7:19 ` [PATCH v2] " Fabio Baltieri
2012-06-06 8:19 ` Bryan Wu
2012-06-06 11:10 ` Fabio Baltieri
2012-06-06 14:10 ` Bryan Wu
2012-06-06 19:11 ` Fabio Baltieri
2012-06-06 19:12 ` [PATCH v3] " Fabio Baltieri
2012-06-06 20:30 ` [PATCH v2] " Shuah Khan
2012-06-07 12:58 ` Bryan Wu
2012-06-11 3:06 ` Shuah Khan
2012-06-11 14:47 ` Bryan Wu
2012-06-06 0:51 ` [PATCH v2 1/2] led: add oneshot trigger Shuah Khan
2012-06-06 2:56 ` Bryan Wu
2012-06-06 6:04 ` Fabio Baltieri
2012-06-06 22:11 ` [PATCH v3] " Fabio Baltieri
2012-06-07 12:58 ` 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=1338932339-1660-2-git-send-email-fabio.baltieri@gmail.com \
--to=fabio.baltieri@gmail.com \
--cc=bryan.wu@canonical.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
Powered by JetHome