Thread (9 messages) 9 messages, 4 authors, 2008-07-27

Re: [PATCH 2/2] RFKILL: set the status of the leds on activation.

From: Ivo van Doorn <hidden>
Date: 2008-07-22 16:54:58

On Tuesday 22 July 2008, Dmitry Baryshkov wrote:
Provide default activate function to set the state of the led
when the led becomes bound to the trigger

Signed-off-by: Dmitry Baryshkov <redacted>
Cc: Ivo van Doorn <redacted>
Cc: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Ivo van Doorn <redacted>
quoted hunk ↗ jump to hunk
-- 
 This patch depends on the patch "leds: make sure led->trigger is set
 earlier" which was staged in -mm for some time and recently got merged
 into leds tree.
---
 net/rfkill/rfkill.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index b247677..e9010ff 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -57,6 +57,16 @@ static void rfkill_led_trigger(struct rfkill *rfkill,
 #endif /* CONFIG_RFKILL_LEDS */
 }
 
+#ifdef CONFIG_RFKILL_LEDS
+static void rfkill_led_trigger_activate(struct led_classdev *led)
+{
+	struct rfkill *rfkill = container_of(led->trigger,
+			struct rfkill, led_trigger);
+
+	rfkill_led_trigger(rfkill, rfkill->state);
+}
+#endif /* CONFIG_RFKILL_LEDS */
+
 static int rfkill_toggle_radio(struct rfkill *rfkill,
 				enum rfkill_state state)
 {
@@ -357,6 +367,8 @@ static void rfkill_led_trigger_register(struct rfkill *rfkill)
 
 	if (!rfkill->led_trigger.name)
 		rfkill->led_trigger.name = rfkill->dev.bus_id;
+	if (!rfkill->led_trigger.activate)
+		rfkill->led_trigger.activate = rfkill_led_trigger_activate;
 	error = led_trigger_register(&rfkill->led_trigger);
 	if (error)
 		rfkill->led_trigger.name = NULL;
-- 
1.5.6.2
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help