Skip to content

Commit

Permalink
rfkill: always call get_state() hook on resume
Browse files Browse the repository at this point in the history
We "optimize" away the get_state() hook call on rfkill_toggle_radio
when doing a forced state change.  This means the resume path is not
calling get_state() as it should.

Call it manually on the resume handler, as we don't want to mess with
the EPO path by removing the optimization.  This has the added benefit
of making it explicit that rfkill->state could have been modified
before we hit the rfkill_toggle_radio() call in the class resume
handler.

Signed-off-by: Henrique de Moraes Holschuh <[email protected]>
Acked-by: Ivo van Doorn <[email protected]>
Cc: Matthew Garrett <[email protected]>
Cc: Alan Jenkins <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
  • Loading branch information
hmh authored and linvjw committed Nov 26, 2008
1 parent f80b5e9 commit 24689c8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions net/rfkill/rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -580,12 +580,22 @@ static int rfkill_suspend(struct device *dev, pm_message_t state)
static int rfkill_resume(struct device *dev)
{
struct rfkill *rfkill = to_rfkill(dev);
enum rfkill_state newstate;

if (dev->power.power_state.event != PM_EVENT_ON) {
mutex_lock(&rfkill->mutex);

dev->power.power_state.event = PM_EVENT_ON;

/*
* rfkill->state could have been modified before we got
* called, and won't be updated by rfkill_toggle_radio()
* in force mode. Sync it FIRST.
*/
if (rfkill->get_state &&
!rfkill->get_state(rfkill->data, &newstate))
rfkill->state = newstate;

/*
* If we are under EPO, kick transmitter offline,
* otherwise restore to pre-suspend state.
Expand Down

0 comments on commit 24689c8

Please sign in to comment.