Skip to content

Commit

Permalink
RFKILL: set the status of the leds on activation.
Browse files Browse the repository at this point in the history
Provide default activate function to set the state of the led
when the led becomes bound to the trigger

Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Dmitry Baryshkov authored and John W. Linville committed Aug 1, 2008
1 parent 7c4f457 commit 9618566
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions net/rfkill/rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,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 void notify_rfkill_state_change(struct rfkill *rfkill)
{
blocking_notifier_call_chain(&rfkill_notifier_list,
Expand Down Expand Up @@ -591,6 +601,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;
Expand Down

0 comments on commit 9618566

Please sign in to comment.