Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 108827
b: refs/heads/master
c: e10e0df
h: refs/heads/master
i:
  108825: dddf271
  108823: 64f10ca
v: v3
  • Loading branch information
Henrique de Moraes Holschuh authored and John W. Linville committed Aug 18, 2008
1 parent bf0f7c2 commit bf31d49
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: aaa1553512b9105699113ea7e2ea726f3d9d4de2
refs/heads/master: e10e0dfe3ba358cfb442cc3bf0d3f2068785bf5c
5 changes: 5 additions & 0 deletions trunk/Documentation/rfkill.txt
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ This rule exists because users of the rfkill subsystem expect to get (and set,
when possible) the overall transmitter rfkill state, not of a particular rfkill
line.

5. During suspend, the rfkill class will attempt to soft-block the radio
through a call to rfkill->toggle_radio, and will try to restore its previous
state during resume. After a rfkill class is suspended, it will *not* call
rfkill->toggle_radio until it is resumed.

Example of a WLAN wireless driver connected to the rfkill subsystem:
--------------------------------------------------------------------

Expand Down
14 changes: 10 additions & 4 deletions trunk/net/rfkill/rfkill.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,8 @@ static void update_rfkill_state(struct rfkill *rfkill)
* calls and handling all the red tape such as issuing notifications
* if the call is successful.
*
* Suspended devices are not touched at all, and -EAGAIN is returned.
*
* Note that the @force parameter cannot override a (possibly cached)
* state of RFKILL_STATE_HARD_BLOCKED. Any device making use of
* RFKILL_STATE_HARD_BLOCKED implements either get_state() or
Expand All @@ -168,6 +170,9 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
int retval = 0;
enum rfkill_state oldstate, newstate;

if (unlikely(rfkill->dev.power.power_state.event & PM_EVENT_SLEEP))
return -EBUSY;

oldstate = rfkill->state;

if (rfkill->get_state && !force &&
Expand Down Expand Up @@ -214,7 +219,7 @@ static int rfkill_toggle_radio(struct rfkill *rfkill,
*
* This function toggles the state of all switches of given type,
* unless a specific switch is claimed by userspace (in which case,
* that switch is left alone).
* that switch is left alone) or suspended.
*/
void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state)
{
Expand All @@ -239,8 +244,8 @@ EXPORT_SYMBOL(rfkill_switch_all);
/**
* rfkill_epo - emergency power off all transmitters
*
* This kicks all rfkill devices to RFKILL_STATE_SOFT_BLOCKED, ignoring
* everything in its path but rfkill_mutex and rfkill->mutex.
* This kicks all non-suspended rfkill devices to RFKILL_STATE_SOFT_BLOCKED,
* ignoring everything in its path but rfkill_mutex and rfkill->mutex.
*/
void rfkill_epo(void)
{
Expand Down Expand Up @@ -458,13 +463,14 @@ static int rfkill_resume(struct device *dev)
if (dev->power.power_state.event != PM_EVENT_ON) {
mutex_lock(&rfkill->mutex);

dev->power.power_state.event = PM_EVENT_ON;

/* restore radio state AND notify everybody */
rfkill_toggle_radio(rfkill, rfkill->state, 1);

mutex_unlock(&rfkill->mutex);
}

dev->power.power_state = PMSG_ON;
return 0;
}
#else
Expand Down

0 comments on commit bf31d49

Please sign in to comment.