rfkill: rfkill_set_block() when suspended nitpick
[deliverable/linux.git] / net / rfkill / core.c
index fa430bd03f1458efe7b66fbb563687ecd4849399..868d79f8ac1d0181abc95092798ab64259026903 100644 (file)
@@ -270,6 +270,9 @@ static void rfkill_set_block(struct rfkill *rfkill, bool blocked)
        unsigned long flags;
        int err;
 
+       if (unlikely(rfkill->dev.power.power_state.event & PM_EVENT_SLEEP))
+               return;
+
        /*
         * Some platforms (...!) generate input events which affect the
         * _hard_ kill state -- whenever something tries to change the
@@ -292,9 +295,6 @@ static void rfkill_set_block(struct rfkill *rfkill, bool blocked)
        rfkill->state |= RFKILL_BLOCK_SW_SETCALL;
        spin_unlock_irqrestore(&rfkill->lock, flags);
 
-       if (unlikely(rfkill->dev.power.power_state.event & PM_EVENT_SLEEP))
-               return;
-
        err = rfkill->ops->set_block(rfkill->data, blocked);
 
        spin_lock_irqsave(&rfkill->lock, flags);
@@ -728,15 +728,11 @@ static int rfkill_resume(struct device *dev)
        struct rfkill *rfkill = to_rfkill(dev);
        bool cur;
 
-       mutex_lock(&rfkill_global_mutex);
-       cur = rfkill_global_states[rfkill->type].cur;
+       cur = !!(rfkill->state & RFKILL_BLOCK_SW);
        rfkill_set_block(rfkill, cur);
-       mutex_unlock(&rfkill_global_mutex);
 
        rfkill->suspended = false;
 
-       schedule_work(&rfkill->uevent_work);
-
        rfkill_resume_polling(rfkill);
 
        return 0;
This page took 0.036164 seconds and 5 git commands to generate.