summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/rfkill/rfkill.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/net/rfkill/rfkill.c b/net/rfkill/rfkill.c
index 5ad411d3e8f8..051d2c9ea66b 100644
--- a/net/rfkill/rfkill.c
+++ b/net/rfkill/rfkill.c
@@ -580,6 +580,7 @@ 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);
@@ -587,6 +588,15 @@ static int rfkill_resume(struct device *dev)
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.
*