diff options
Diffstat (limited to 'net/rfkill/rfkill.c')
| -rw-r--r-- | net/rfkill/rfkill.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c index d2d45655cd1a..74aecc098bad 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 | { |
| @@ -372,7 +377,7 @@ static ssize_t rfkill_claim_show(struct device *dev, | |||
| 372 | { | 377 | { |
| 373 | struct rfkill *rfkill = to_rfkill(dev); | 378 | struct rfkill *rfkill = to_rfkill(dev); |
| 374 | 379 | ||
| 375 | return sprintf(buf, "%d", rfkill->user_claim); | 380 | return sprintf(buf, "%d\n", rfkill->user_claim); |
| 376 | } | 381 | } |
| 377 | 382 | ||
| 378 | static ssize_t rfkill_claim_store(struct device *dev, | 383 | static ssize_t rfkill_claim_store(struct device *dev, |
| @@ -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 |
