mac80211: further simplify ieee80211_bss_info_change_notify
authorJohannes Berg <johannes.berg@intel.com>
Fri, 14 Dec 2012 13:22:10 +0000 (14:22 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 3 Jan 2013 12:01:36 +0000 (13:01 +0100)
The special case in the function isn't really needed,
instead make the suspend code a bit better and also
easier to understand and move the warning into the
driver op wrapper inline.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/driver-ops.h
net/mac80211/main.c
net/mac80211/pm.c

index 608ced41548d8aaa23cb2c51c9a7c112caa85df7..cccc486ae3d08ae1a7b450a870270010266bc5eb 100644 (file)
@@ -207,6 +207,12 @@ static inline void drv_bss_info_changed(struct ieee80211_local *local,
 {
        might_sleep();
 
+       WARN_ON_ONCE(changed & (BSS_CHANGED_BEACON |
+                               BSS_CHANGED_BEACON_ENABLED) &&
+                    sdata->vif.type != NL80211_IFTYPE_AP &&
+                    sdata->vif.type != NL80211_IFTYPE_ADHOC &&
+                    sdata->vif.type != NL80211_IFTYPE_MESH_POINT);
+
        check_sdata_in_driver(sdata);
 
        trace_drv_bss_info_changed(local, sdata, info, changed);
index 71a64f49fe6185e3e134ad3fd24d72883853a18c..b719a16eabdefad1530f26da10eb4e29b6957d7f 100644 (file)
@@ -231,20 +231,6 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
                return;
        }
 
-       switch (sdata->vif.type) {
-       case NL80211_IFTYPE_AP:
-       case NL80211_IFTYPE_ADHOC:
-       case NL80211_IFTYPE_WDS:
-       case NL80211_IFTYPE_MESH_POINT:
-               break;
-       default:
-               /* do not warn to simplify caller in scan.c */
-               changed &= ~BSS_CHANGED_BEACON_ENABLED;
-               if (WARN_ON(changed & BSS_CHANGED_BEACON))
-                       return;
-               break;
-       }
-
        drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed);
 }
 
index 712c17ff6e2228e605d443b16546f50dfeae70eb..8a67d7e982f79f1f1c847b609d1e38bebec3bc4b 100644 (file)
@@ -121,7 +121,7 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
 
        /* remove all interfaces */
        list_for_each_entry(sdata, &local->interfaces, list) {
-               u32 changed = BSS_CHANGED_BEACON_ENABLED;
+               u32 changed = 0;
 
                if (!ieee80211_sdata_running(sdata))
                        continue;
@@ -136,14 +136,19 @@ int __ieee80211_suspend(struct ieee80211_hw *hw, struct cfg80211_wowlan *wowlan)
                                changed = BSS_CHANGED_ASSOC |
                                          BSS_CHANGED_BSSID |
                                          BSS_CHANGED_IDLE;
-                       else
-                               changed = 0;
-                       /* fall through */
+                       break;
+               case NL80211_IFTYPE_AP:
+               case NL80211_IFTYPE_ADHOC:
+               case NL80211_IFTYPE_MESH_POINT:
+                       if (sdata->vif.bss_conf.enable_beacon)
+                               changed = BSS_CHANGED_BEACON_ENABLED;
+                       break;
                default:
-                       ieee80211_quiesce(sdata);
                        break;
                }
 
+               ieee80211_quiesce(sdata);
+
                sdata->suspend_bss_conf = sdata->vif.bss_conf;
                memset(&sdata->vif.bss_conf, 0, sizeof(sdata->vif.bss_conf));
                sdata->vif.bss_conf.idle = true;