Commit 7fa20a7f60df0afceafbb8197b5d110507f42c72

Authored by Alan Jenkins
Committed by John W. Linville
1 parent f0214843ba

rfkill: rfkill_set_block() when suspended nitpick

If we return after fiddling with the state, userspace will see the
wrong state and rfkill_set_sw_state() won't work until the next call to
rfkill_set_block().  At the moment rfkill_set_block() will always be
called from rfkill_resume(), but this will change in future.

Also, presumably the point of this test is to avoid bothering devices
which may be suspended.  If we don't want to call set_block(), we
probably don't want to call query() either :-).

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Signed-off-by: John W. Linville <linville@tuxdriver.com>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

... ... @@ -270,6 +270,9 @@
270 270 unsigned long flags;
271 271 int err;
272 272  
  273 + if (unlikely(rfkill->dev.power.power_state.event & PM_EVENT_SLEEP))
  274 + return;
  275 +
273 276 /*
274 277 * Some platforms (...!) generate input events which affect the
275 278 * _hard_ kill state -- whenever something tries to change the
... ... @@ -291,9 +294,6 @@
291 294  
292 295 rfkill->state |= RFKILL_BLOCK_SW_SETCALL;
293 296 spin_unlock_irqrestore(&rfkill->lock, flags);
294   -
295   - if (unlikely(rfkill->dev.power.power_state.event & PM_EVENT_SLEEP))
296   - return;
297 297  
298 298 err = rfkill->ops->set_block(rfkill->data, blocked);
299 299