Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
[linux-2.6.git] / net / mac80211 / main.c
index b142bd4..2306d75 100644 (file)
@@ -155,7 +155,8 @@ int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
                power = chan->max_power;
        else
                power = local->power_constr_level ?
-                       (chan->max_power - local->power_constr_level) :
+                       min(chan->max_power,
+                               (chan->max_reg_power  - local->power_constr_level)) :
                        chan->max_power;
 
        if (local->user_power_level >= 0)
@@ -198,15 +199,7 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
                return;
 
        if (sdata->vif.type == NL80211_IFTYPE_STATION) {
-               /*
-                * While not associated, claim a BSSID of all-zeroes
-                * so that drivers don't do any weird things with the
-                * BSSID at that time.
-                */
-               if (sdata->vif.bss_conf.assoc)
-                       sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
-               else
-                       sdata->vif.bss_conf.bssid = zero;
+               sdata->vif.bss_conf.bssid = sdata->u.mgd.bssid;
        } else if (sdata->vif.type == NL80211_IFTYPE_ADHOC)
                sdata->vif.bss_conf.bssid = sdata->u.ibss.bssid;
        else if (sdata->vif.type == NL80211_IFTYPE_AP)
@@ -534,6 +527,9 @@ struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
        int priv_size, i;
        struct wiphy *wiphy;
 
+       if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove)))
+               return NULL;
+
        /* Ensure 32-byte alignment of our private data and hw private data.
         * We use the wiphy priv data for both our ieee80211_local and for
         * the driver's private data
@@ -701,6 +697,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
            )
                return -EINVAL;
 
+       if ((hw->flags & IEEE80211_HW_SCAN_WHILE_IDLE) && !local->ops->hw_scan)
+               return -EINVAL;
+
        if (hw->max_report_rates == 0)
                hw->max_report_rates = hw->max_rates;