rfkill: update LEDs for all state changes
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Fri, 3 Oct 2008 19:58:05 +0000 (16:58 -0300)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 6 Oct 2008 22:14:57 +0000 (18:14 -0400)
The LED state was not being updated by rfkill_force_state(), which
will cause regressions in wireless drivers that had old-style rfkill
support and are updated to use rfkill_force_state().

The LED state was not being updated when a change was detected through
the rfkill->get_state() hook, either.

Move the LED trigger update calls into notify_rfkill_state_change(),
where it should have been in the first place.  This takes care of both
issues above.

Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Acked-by: Ivo van Doorn <IvDoorn@gmail.com>
Cc: stable@kernel.org
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/rfkill/rfkill.c

index ea0dc04b3c77c15efda3d8931f38ec7e3afc71a5..f949a482b0078b904d88b655da399d8706a48ca8 100644 (file)
@@ -125,6 +125,7 @@ static void rfkill_led_trigger_activate(struct led_classdev *led)
 
 static void notify_rfkill_state_change(struct rfkill *rfkill)
 {
+       rfkill_led_trigger(rfkill, rfkill->state);
        blocking_notifier_call_chain(&rfkill_notifier_list,
                        RFKILL_STATE_CHANGED,
                        rfkill);
@@ -217,10 +218,8 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
                        rfkill->state = state;
        }
 
-       if (force || rfkill->state != oldstate) {
-               rfkill_led_trigger(rfkill, rfkill->state);
+       if (force || rfkill->state != oldstate)
                notify_rfkill_state_change(rfkill);
-       }
 
        return retval;
 }