iwlwifi: serialize station management actions
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-sta.c
index c15098e..c27c13f 100644 (file)
@@ -284,10 +284,12 @@ static u8 iwl_prep_station(struct iwl_priv *priv, const u8 *addr,
        station->sta.sta.sta_id = sta_id;
        station->sta.station_flags = 0;
 
-       /* BCAST station and IBSS stations do not work in HT mode */
-       if (sta_id != priv->hw_params.bcast_sta_id &&
-           priv->iw_mode != NL80211_IFTYPE_ADHOC)
-               iwl_set_ht_add_station(priv, sta_id, ht_info);
+       /*
+        * OK to call unconditionally, since local stations (IBSS BSSID
+        * STA and broadcast STA) pass in a NULL ht_info, and mac80211
+        * doesn't allow HT IBSS.
+        */
+       iwl_set_ht_add_station(priv, sta_id, ht_info);
 
        /* 3945 only */
        rate = (priv->band == IEEE80211_BAND_5GHZ) ?
@@ -429,7 +431,7 @@ int iwl_add_bssid_station(struct iwl_priv *priv, const u8 *addr, bool init_rs,
        struct iwl_link_quality_cmd *link_cmd;
        unsigned long flags;
 
-       if (*sta_id_r)
+       if (sta_id_r)
                *sta_id_r = IWL_INVALID_STATION;
 
        ret = iwl_add_station_common(priv, addr, 0, NULL, &sta_id);
@@ -1371,10 +1373,14 @@ int iwl_mac_sta_remove(struct ieee80211_hw *hw,
 
        IWL_DEBUG_INFO(priv, "received request to remove station %pM\n",
                        sta->addr);
+       mutex_lock(&priv->mutex);
+       IWL_DEBUG_INFO(priv, "proceeding to remove station %pM\n",
+                       sta->addr);
        ret = iwl_remove_station(priv, sta_common->sta_id, sta->addr);
        if (ret)
                IWL_ERR(priv, "Error removing station %pM\n",
                        sta->addr);
+       mutex_unlock(&priv->mutex);
        return ret;
 }
 EXPORT_SYMBOL(iwl_mac_sta_remove);