Merge branch 'core-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[pandora-kernel.git] / net / mac80211 / pm.c
index 7a549f9..5e3d476 100644 (file)
@@ -55,15 +55,6 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
 
        rcu_read_unlock();
 
-       /* flush again, in case driver queued work */
-       flush_workqueue(local->hw.workqueue);
-
-       /* stop hardware - this must stop RX */
-       if (local->open_count) {
-               ieee80211_led_radio(local, false);
-               drv_stop(local);
-       }
-
        /* remove STAs */
        spin_lock_irqsave(&local->sta_lock, flags);
        list_for_each_entry(sta, &local->sta_list, list) {
@@ -111,7 +102,22 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
                drv_remove_interface(local, &conf);
        }
 
+       /* stop hardware - this must stop RX */
+       if (local->open_count) {
+               ieee80211_led_radio(local, false);
+               drv_stop(local);
+       }
+
+       /*
+        * flush again, in case driver queued work -- it
+        * shouldn't be doing (or cancel everything in the
+        * stop callback) that but better safe than sorry.
+        */
+       flush_workqueue(local->hw.workqueue);
+
        local->suspended = true;
+       /* need suspended to be visible before quiescing is false */
+       barrier();
        local->quiescing = false;
 
        return 0;