Merge master.kernel.org:/pub/scm/linux/kernel/git/padovan/bluetooth-2.6
[pandora-kernel.git] / drivers / net / wireless / ath / ath9k / htc_drv_beacon.c
index 97b116f..57fe22b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010 Atheros Communications Inc.
+ * Copyright (c) 2010-2011 Atheros Communications Inc.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -74,12 +74,12 @@ static void ath9k_htc_beacon_config_sta(struct ath9k_htc_priv *priv,
        __be32 htc_imask = 0;
        u64 tsf;
        int num_beacons, offset, dtim_dec_count, cfp_dec_count;
-       int ret;
+       int ret __attribute__ ((unused));
        u8 cmd_rsp;
 
        memset(&bs, 0, sizeof(bs));
 
-       intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
+       intval = bss_conf->beacon_interval;
        bmiss_timeout = (ATH_DEFAULT_BMISS_LIMIT * bss_conf->beacon_interval);
 
        /*
@@ -190,11 +190,11 @@ static void ath9k_htc_beacon_config_ap(struct ath9k_htc_priv *priv,
        enum ath9k_int imask = 0;
        u32 nexttbtt, intval, tsftu;
        __be32 htc_imask = 0;
-       int ret;
+       int ret __attribute__ ((unused));
        u8 cmd_rsp;
        u64 tsf;
 
-       intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
+       intval = bss_conf->beacon_interval;
        intval /= ATH9K_HTC_MAX_BCN_VIF;
        nexttbtt = intval;
 
@@ -246,11 +246,11 @@ static void ath9k_htc_beacon_config_adhoc(struct ath9k_htc_priv *priv,
        enum ath9k_int imask = 0;
        u32 nexttbtt, intval, tsftu;
        __be32 htc_imask = 0;
-       int ret;
+       int ret __attribute__ ((unused));
        u8 cmd_rsp;
        u64 tsf;
 
-       intval = bss_conf->beacon_interval & ATH9K_BEACON_PERIOD;
+       intval = bss_conf->beacon_interval;
        nexttbtt = intval;
 
        /*
@@ -299,7 +299,7 @@ static void ath9k_htc_send_buffered(struct ath9k_htc_priv *priv,
        struct ieee80211_vif *vif;
        struct sk_buff *skb;
        struct ieee80211_hdr *hdr;
-       int padpos, padsize, ret;
+       int padpos, padsize, ret, tx_slot;
 
        spin_lock_bh(&priv->beacon_lock);
 
@@ -321,11 +321,20 @@ static void ath9k_htc_send_buffered(struct ath9k_htc_priv *priv,
                        memmove(skb->data, skb->data + padsize, padpos);
                }
 
-               ret = ath9k_htc_tx_start(priv, skb, true);
+               tx_slot = ath9k_htc_tx_get_slot(priv);
+               if (tx_slot < 0) {
+                       ath_dbg(common, ATH_DBG_XMIT, "No free CAB slot\n");
+                       dev_kfree_skb_any(skb);
+                       goto next;
+               }
+
+               ret = ath9k_htc_tx_start(priv, skb, tx_slot, true);
                if (ret != 0) {
-                       ath_dbg(common, ATH_DBG_FATAL,
-                               "Failed to send CAB frame\n");
+                       ath9k_htc_tx_clear_slot(priv, tx_slot);
                        dev_kfree_skb_any(skb);
+
+                       ath_dbg(common, ATH_DBG_XMIT,
+                               "Failed to send CAB frame\n");
                } else {
                        spin_lock_bh(&priv->tx.tx_lock);
                        priv->tx.queued_cnt++;
@@ -418,7 +427,7 @@ static int ath9k_htc_choose_bslot(struct ath9k_htc_priv *priv,
        u16 intval;
        int slot;
 
-       intval = priv->cur_beacon_conf.beacon_interval & ATH9K_BEACON_PERIOD;
+       intval = priv->cur_beacon_conf.beacon_interval;
 
        tsf = be64_to_cpu(swba->tsf);
        tsftu = TSF_TO_TU(tsf >> 32, tsf);