]> git.baikalelectronics.ru Git - kernel.git/commit
rfkill: ignore errors from rfkill_toggle_radio in rfkill_add_switch
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>
Thu, 3 Jul 2008 16:14:57 +0000 (13:14 -0300)
committerJohn W. Linville <linville@tuxdriver.com>
Tue, 8 Jul 2008 18:16:03 +0000 (14:16 -0400)
commit61f8401f7a1ad7690d6ae42d835ae07714555cad
treeb7cf0b5b4ade5c3cd4351b1a1256432356898068
parentfbfb491c451e4955362d4d05d904fc75c46df924
rfkill: ignore errors from rfkill_toggle_radio in rfkill_add_switch

rfkill_add_switch() calls rfkill_toggle_radio() to set the state of a
recently registered rfkill class to the current global state [for that
rfkill->type].

The rfkill_toggle_radio() call is going to error out if the hardware is
RFKILL_STATE_HARD_BLOCKED, and the global state is RFKILL_STATE_UNBLOCKED.

That is a quite normal situation which I missed to account for.  As things
stand, the error return from rfkill_toggle_radio ends up causing
rfkill_register to bail out with an error (de-registering the new switch in
the process), which is Not Nice.

Change rfkill_add_switch() to not return errors because of a failed call to
rfkill_toggle_radio().  We can go back to returning errors again (if that's
indeed the right thing to do) if we define the exact error codes the
rfkill->toggle_radio callbacks are to return in each situation, so that we
can ignore the right ones only.

Bug reported by "kionez <kionez@anche.no>".

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