mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: barebox@lists.infradead.org
Subject: [PATCH 1/4] led: trigger: disable LEDs with trigger before installing it
Date: Sat,  9 Nov 2013 14:24:06 +0100	[thread overview]
Message-ID: <1384003450-21001-2-git-send-email-sebastian.hesselbarth@gmail.com> (raw)
In-Reply-To: <1384003450-21001-1-git-send-email-sebastian.hesselbarth@gmail.com>

This disables LEDs that have a trigger function assigned right before
the trigger is installed. As the trigger was parsed before the LED has
been registered, also swap LED registration and trigger parsing.

Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
---
Cc: barebox@lists.infradead.org
---
 drivers/led/led-gpio.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/led/led-gpio.c b/drivers/led/led-gpio.c
index 69db70f..7a5ef47 100644
--- a/drivers/led/led-gpio.c
+++ b/drivers/led/led-gpio.c
@@ -225,6 +225,8 @@ static void led_of_parse_trigger(struct led *led, struct device_node *np)
 	for (i = 0; i < ARRAY_SIZE(triggers); i++) {
 		struct led_trg *trg = &triggers[i];
 		if (!strcmp(trg->str, trigger)) {
+			/* disable LED before installing trigger */
+			led_set(led, 0);
 			led_set_trigger(trg->trg, led);
 			return;
 		}
@@ -252,8 +254,8 @@ static int led_gpio_of_probe(struct device_d *dev)
 		dev_dbg(dev, "register led %s on gpio%d, active_low = %d\n",
 			gled->led.name, gled->gpio, gled->active_low);
 
-		led_of_parse_trigger(&gled->led, child);
 		led_gpio_register(gled);
+		led_of_parse_trigger(&gled->led, child);
 	}
 
 	return 0;
-- 
1.8.4.rc3


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2013-11-09 13:24 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-09 13:24 [PATCH 0/4] gpiolib debug and led trigger fixes Sebastian Hesselbarth
2013-11-09 13:24 ` Sebastian Hesselbarth [this message]
2013-11-09 13:24 ` [PATCH 2/4] gpiolib: add get_direction callback Sebastian Hesselbarth
2013-11-09 13:24 ` [PATCH 3/4] gpiolib: make gpiolib command more verbose Sebastian Hesselbarth
2013-11-11  1:30   ` Alexander Aring
2013-11-11  8:07     ` Sascha Hauer
2013-11-11  8:12       ` Alexander Aring
2013-11-09 13:24 ` [PATCH 4/4] gpio: dw: add get_direction callback Sebastian Hesselbarth

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=1384003450-21001-2-git-send-email-sebastian.hesselbarth@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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