mac80211: add ieee80211_sdata_running
[linux-2.6.git] / net / mac80211 / pm.c
index 7a549f9..913dc7e 100644 (file)
@@ -26,7 +26,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
        /* make quiescing visible to timers everywhere */
        mb();
 
-       flush_workqueue(local->hw.workqueue);
+       flush_workqueue(local->workqueue);
 
        /* Don't try to run timers while suspended. */
        del_timer_sync(&local->sta_cleanup);
@@ -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) {
@@ -74,7 +65,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
                                             struct ieee80211_sub_if_data,
                                             u.ap);
 
-                       drv_sta_notify(local, &sdata->vif, STA_NOTIFY_REMOVE,
+                       drv_sta_notify(local, sdata, STA_NOTIFY_REMOVE,
                                       &sta->sta);
                }
 
@@ -102,16 +93,26 @@ int __ieee80211_suspend(struct ieee80211_hw *hw)
                        break;
                }
 
-               if (!netif_running(sdata->dev))
+               if (!ieee80211_sdata_running(sdata))
                        continue;
 
+               /* disable beaconing */
+               ieee80211_bss_info_change_notify(sdata,
+                       BSS_CHANGED_BEACON_ENABLED);
+
                conf.vif = &sdata->vif;
                conf.type = sdata->vif.type;
-               conf.mac_addr = sdata->dev->dev_addr;
+               conf.mac_addr = sdata->vif.addr;
                drv_remove_interface(local, &conf);
        }
 
+       /* stop hardware - this must stop RX */
+       if (local->open_count)
+               ieee80211_stop_device(local);
+
        local->suspended = true;
+       /* need suspended to be visible before quiescing is false */
+       barrier();
        local->quiescing = false;
 
        return 0;