Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6
[pandora-kernel.git] / drivers / net / wireless / iwlwifi / iwl-agn-sta.c
index 0bd722c..001622c 100644 (file)
 #include "iwl-core.h"
 #include "iwl-sta.h"
 #include "iwl-agn.h"
+#include "iwl-trans.h"
 
 static struct iwl_link_quality_cmd *
-iwl_sta_alloc_lq(struct iwl_priv *priv, u8 sta_id)
+iwl_sta_alloc_lq(struct iwl_priv *priv, struct iwl_rxon_context *ctx, u8 sta_id)
 {
        int i, r;
        struct iwl_link_quality_cmd *link_cmd;
@@ -47,10 +48,15 @@ iwl_sta_alloc_lq(struct iwl_priv *priv, u8 sta_id)
                IWL_ERR(priv, "Unable to allocate memory for LQ cmd.\n");
                return NULL;
        }
+
+       lockdep_assert_held(&priv->mutex);
+
        /* Set up the rate scaling to start at selected rate, fall back
         * all the way down to 1M in IEEE order, and then spin on 1M */
        if (priv->band == IEEE80211_BAND_5GHZ)
                r = IWL_RATE_6M_INDEX;
+       else if (ctx && ctx->vif && ctx->vif->p2p)
+               r = IWL_RATE_6M_INDEX;
        else
                r = IWL_RATE_1M_INDEX;
 
@@ -115,7 +121,7 @@ int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 
        /* Set up default rate scaling table in device's station table */
-       link_cmd = iwl_sta_alloc_lq(priv, sta_id);
+       link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id);
        if (!link_cmd) {
                IWL_ERR(priv, "Unable to initialize rate scaling for station %pM.\n",
                        addr);
@@ -175,7 +181,7 @@ static int iwl_send_static_wepkey_cmd(struct iwl_priv *priv,
        cmd.len[0] = cmd_size;
 
        if (not_empty || send_if_empty)
-               return iwl_send_cmd(priv, &cmd);
+               return trans_send_cmd(priv, &cmd);
        else
                return 0;
 }
@@ -554,7 +560,7 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
        priv->stations[sta_id].used |= IWL_STA_BCAST;
        spin_unlock_irqrestore(&priv->sta_lock, flags);
 
-       link_cmd = iwl_sta_alloc_lq(priv, sta_id);
+       link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id);
        if (!link_cmd) {
                IWL_ERR(priv,
                        "Unable to initialize rate scaling for bcast station.\n");
@@ -574,14 +580,14 @@ int iwlagn_alloc_bcast_station(struct iwl_priv *priv,
  * Only used by iwlagn. Placed here to have all bcast station management
  * code together.
  */
-static int iwl_update_bcast_station(struct iwl_priv *priv,
-                                   struct iwl_rxon_context *ctx)
+int iwl_update_bcast_station(struct iwl_priv *priv,
+                            struct iwl_rxon_context *ctx)
 {
        unsigned long flags;
        struct iwl_link_quality_cmd *link_cmd;
        u8 sta_id = ctx->bcast_sta_id;
 
-       link_cmd = iwl_sta_alloc_lq(priv, sta_id);
+       link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id);
        if (!link_cmd) {
                IWL_ERR(priv, "Unable to initialize rate scaling for bcast station.\n");
                return -ENOMEM;