diff options
-rw-r--r-- | Documentation/rfkill.txt | 5 | ||||
-rw-r--r-- | net/rfkill/rfkill.c | 14 |
2 files changed, 15 insertions, 4 deletions
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt index 28b6ec87c642..6fcb3060dec5 100644 --- a/Documentation/rfkill.txt +++ b/Documentation/rfkill.txt | |||
@@ -363,6 +363,11 @@ This rule exists because users of the rfkill subsystem expect to get (and set, | |||
363 | when possible) the overall transmitter rfkill state, not of a particular rfkill | 363 | when possible) the overall transmitter rfkill state, not of a particular rfkill |
364 | line. | 364 | line. |
365 | 365 | ||
366 | 5. During suspend, the rfkill class will attempt to soft-block the radio | ||
367 | through a call to rfkill->toggle_radio, and will try to restore its previous | ||
368 | state during resume. After a rfkill class is suspended, it will *not* call | ||
369 | rfkill->toggle_radio until it is resumed. | ||
370 | |||
366 | Example of a WLAN wireless driver connected to the rfkill subsystem: | 371 | Example of a WLAN wireless driver connected to the rfkill subsystem: |
367 | -------------------------------------------------------------------- | 372 | -------------------------------------------------------------------- |
368 | 373 | ||
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index d2d45655cd1a..35a9994e2339 100644 --- a/net/rfkill/rfkill.c +++ b/net/rfkill/rfkill.c | |||
@@ -150,6 +150,8 @@ static void update_rfkill_state(struct rfkill *rfkill) | |||
150 | * calls and handling all the red tape such as issuing notifications | 150 | * calls and handling all the red tape such as issuing notifications |
151 | * if the call is successful. | 151 | * if the call is successful. |
152 | * | 152 | * |
153 | * Suspended devices are not touched at all, and -EAGAIN is returned. | ||
154 | * | ||
153 | * Note that the @force parameter cannot override a (possibly cached) | 155 | * Note that the @force parameter cannot override a (possibly cached) |
154 | * state of RFKILL_STATE_HARD_BLOCKED. Any device making use of | 156 | * state of RFKILL_STATE_HARD_BLOCKED. Any device making use of |
155 | * RFKILL_STATE_HARD_BLOCKED implements either get_state() or | 157 | * RFKILL_STATE_HARD_BLOCKED implements either get_state() or |
@@ -168,6 +170,9 @@ static int rfkill_toggle_radio(struct rfkill *rfkill, | |||
168 | int retval = 0; | 170 | int retval = 0; |
169 | enum rfkill_state oldstate, newstate; | 171 | enum rfkill_state oldstate, newstate; |
170 | 172 | ||
173 | if (unlikely(rfkill->dev.power.power_state.event & PM_EVENT_SLEEP)) | ||
174 | return -EBUSY; | ||
175 | |||
171 | oldstate = rfkill->state; | 176 | oldstate = rfkill->state; |
172 | 177 | ||
173 | if (rfkill->get_state && !force && | 178 | if (rfkill->get_state && !force && |
@@ -214,7 +219,7 @@ static int rfkill_toggle_radio(struct rfkill *rfkill, | |||
214 | * | 219 | * |
215 | * This function toggles the state of all switches of given type, | 220 | * This function toggles the state of all switches of given type, |
216 | * unless a specific switch is claimed by userspace (in which case, | 221 | * unless a specific switch is claimed by userspace (in which case, |
217 | * that switch is left alone). | 222 | * that switch is left alone) or suspended. |
218 | */ | 223 | */ |
219 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state) | 224 | void rfkill_switch_all(enum rfkill_type type, enum rfkill_state state) |
220 | { | 225 | { |
@@ -239,8 +244,8 @@ EXPORT_SYMBOL(rfkill_switch_all); | |||
239 | /** | 244 | /** |
240 | * rfkill_epo - emergency power off all transmitters | 245 | * rfkill_epo - emergency power off all transmitters |
241 | * | 246 | * |
242 | * This kicks all rfkill devices to RFKILL_STATE_SOFT_BLOCKED, ignoring | 247 | * This kicks all non-suspended rfkill devices to RFKILL_STATE_SOFT_BLOCKED, |
243 | * everything in its path but rfkill_mutex and rfkill->mutex. | 248 | * ignoring everything in its path but rfkill_mutex and rfkill->mutex. |
244 | */ | 249 | */ |
245 | void rfkill_epo(void) | 250 | void rfkill_epo(void) |
246 | { | 251 | { |
@@ -458,13 +463,14 @@ static int rfkill_resume(struct device *dev) | |||
458 | if (dev->power.power_state.event != PM_EVENT_ON) { | 463 | if (dev->power.power_state.event != PM_EVENT_ON) { |
459 | mutex_lock(&rfkill->mutex); | 464 | mutex_lock(&rfkill->mutex); |
460 | 465 | ||
466 | dev->power.power_state.event = PM_EVENT_ON; | ||
467 | |||
461 | /* restore radio state AND notify everybody */ | 468 | /* restore radio state AND notify everybody */ |
462 | rfkill_toggle_radio(rfkill, rfkill->state, 1); | 469 | rfkill_toggle_radio(rfkill, rfkill->state, 1); |
463 | 470 | ||
464 | mutex_unlock(&rfkill->mutex); | 471 | mutex_unlock(&rfkill->mutex); |
465 | } | 472 | } |
466 | 473 | ||
467 | dev->power.power_state = PMSG_ON; | ||
468 | return 0; | 474 | return 0; |
469 | } | 475 | } |
470 | #else | 476 | #else |