aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-10-11 17:31:01 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-10-14 13:39:59 -0400
commite4744ec78669926000e47e6ec78b987c0b2f10e9 (patch)
treea25a0aab90ee77d16ed424729eae4529c69aba9f
parentc648ecb044a0536be0f40533663eae9f20f1e83e (diff)
ath9k_hw: remove references to hw->conf
Accessing it to get the current operating channel is racy and in the way of further channel handling related changes Signed-off-by: Felix Fietkau <nbd@openwrt.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/ath/ath9k/ar5008_phy.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_phy.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/calib.c8
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c21
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h2
5 files changed, 15 insertions, 20 deletions
diff --git a/drivers/net/wireless/ath/ath9k/ar5008_phy.c b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
index b197bf2047e7..ff415e863ee9 100644
--- a/drivers/net/wireless/ath/ath9k/ar5008_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar5008_phy.c
@@ -672,7 +672,7 @@ static void ar5008_hw_set_channel_regs(struct ath_hw *ah,
672 } 672 }
673 REG_WRITE(ah, AR_PHY_TURBO, phymode); 673 REG_WRITE(ah, AR_PHY_TURBO, phymode);
674 674
675 ath9k_hw_set11nmac2040(ah); 675 ath9k_hw_set11nmac2040(ah, chan);
676 676
677 ENABLE_REGWRITE_BUFFER(ah); 677 ENABLE_REGWRITE_BUFFER(ah);
678 678
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_phy.c b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
index 312c868f05be..f3adafd33704 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_phy.c
+++ b/drivers/net/wireless/ath/ath9k/ar9003_phy.c
@@ -564,7 +564,7 @@ static void ar9003_hw_set_channel_regs(struct ath_hw *ah,
564 REG_WRITE(ah, AR_PHY_GEN_CTRL, phymode); 564 REG_WRITE(ah, AR_PHY_GEN_CTRL, phymode);
565 565
566 /* Configure MAC for 20/40 operation */ 566 /* Configure MAC for 20/40 operation */
567 ath9k_hw_set11nmac2040(ah); 567 ath9k_hw_set11nmac2040(ah, chan);
568 568
569 /* global transmit timeout (25 TUs default)*/ 569 /* global transmit timeout (25 TUs default)*/
570 REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S); 570 REG_WRITE(ah, AR_GTXTO, 25 << AR_GTXTO_TIMEOUT_LIMIT_S);
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index fe23026d82cd..d8db74b0ef66 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -186,7 +186,6 @@ void ath9k_hw_reset_calibration(struct ath_hw *ah,
186bool ath9k_hw_reset_calvalid(struct ath_hw *ah) 186bool ath9k_hw_reset_calvalid(struct ath_hw *ah)
187{ 187{
188 struct ath_common *common = ath9k_hw_common(ah); 188 struct ath_common *common = ath9k_hw_common(ah);
189 struct ieee80211_conf *conf = &common->hw->conf;
190 struct ath9k_cal_list *currCal = ah->cal_list_curr; 189 struct ath9k_cal_list *currCal = ah->cal_list_curr;
191 190
192 if (!ah->caldata) 191 if (!ah->caldata)
@@ -208,7 +207,7 @@ bool ath9k_hw_reset_calvalid(struct ath_hw *ah)
208 return true; 207 return true;
209 208
210 ath_dbg(common, CALIBRATE, "Resetting Cal %d state for channel %u\n", 209 ath_dbg(common, CALIBRATE, "Resetting Cal %d state for channel %u\n",
211 currCal->calData->calType, conf->chandef.chan->center_freq); 210 currCal->calData->calType, ah->curchan->chan->center_freq);
212 211
213 ah->caldata->CalValid &= ~currCal->calData->calType; 212 ah->caldata->CalValid &= ~currCal->calData->calType;
214 currCal->calState = CAL_WAITING; 213 currCal->calState = CAL_WAITING;
@@ -242,7 +241,6 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
242 int32_t val; 241 int32_t val;
243 u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask; 242 u8 chainmask = (ah->rxchainmask << 3) | ah->rxchainmask;
244 struct ath_common *common = ath9k_hw_common(ah); 243 struct ath_common *common = ath9k_hw_common(ah);
245 struct ieee80211_conf *conf = &common->hw->conf;
246 s16 default_nf = ath9k_hw_get_default_nf(ah, chan); 244 s16 default_nf = ath9k_hw_get_default_nf(ah, chan);
247 245
248 if (ah->caldata) 246 if (ah->caldata)
@@ -252,7 +250,7 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
252 if (chainmask & (1 << i)) { 250 if (chainmask & (1 << i)) {
253 s16 nfval; 251 s16 nfval;
254 252
255 if ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf)) 253 if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan))
256 continue; 254 continue;
257 255
258 if (h) 256 if (h)
@@ -314,7 +312,7 @@ void ath9k_hw_loadnf(struct ath_hw *ah, struct ath9k_channel *chan)
314 ENABLE_REGWRITE_BUFFER(ah); 312 ENABLE_REGWRITE_BUFFER(ah);
315 for (i = 0; i < NUM_NF_READINGS; i++) { 313 for (i = 0; i < NUM_NF_READINGS; i++) {
316 if (chainmask & (1 << i)) { 314 if (chainmask & (1 << i)) {
317 if ((i >= AR5416_MAX_CHAINS) && !conf_is_ht40(conf)) 315 if ((i >= AR5416_MAX_CHAINS) && !IS_CHAN_HT40(chan))
318 continue; 316 continue;
319 317
320 val = REG_READ(ah, ah->nf_regs[i]); 318 val = REG_READ(ah, ah->nf_regs[i]);
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index bc7382fbcf66..dcdbab48709e 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -130,29 +130,29 @@ void ath9k_debug_sync_cause(struct ath_common *common, u32 sync_cause)
130 130
131static void ath9k_hw_set_clockrate(struct ath_hw *ah) 131static void ath9k_hw_set_clockrate(struct ath_hw *ah)
132{ 132{
133 struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
134 struct ath_common *common = ath9k_hw_common(ah); 133 struct ath_common *common = ath9k_hw_common(ah);
134 struct ath9k_channel *chan = ah->curchan;
135 unsigned int clockrate; 135 unsigned int clockrate;
136 136
137 /* AR9287 v1.3+ uses async FIFO and runs the MAC at 117 MHz */ 137 /* AR9287 v1.3+ uses async FIFO and runs the MAC at 117 MHz */
138 if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah)) 138 if (AR_SREV_9287(ah) && AR_SREV_9287_13_OR_LATER(ah))
139 clockrate = 117; 139 clockrate = 117;
140 else if (!ah->curchan) /* should really check for CCK instead */ 140 else if (!chan) /* should really check for CCK instead */
141 clockrate = ATH9K_CLOCK_RATE_CCK; 141 clockrate = ATH9K_CLOCK_RATE_CCK;
142 else if (conf->chandef.chan->band == IEEE80211_BAND_2GHZ) 142 else if (IS_CHAN_2GHZ(chan))
143 clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM; 143 clockrate = ATH9K_CLOCK_RATE_2GHZ_OFDM;
144 else if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK) 144 else if (ah->caps.hw_caps & ATH9K_HW_CAP_FASTCLOCK)
145 clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM; 145 clockrate = ATH9K_CLOCK_FAST_RATE_5GHZ_OFDM;
146 else 146 else
147 clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM; 147 clockrate = ATH9K_CLOCK_RATE_5GHZ_OFDM;
148 148
149 if (conf_is_ht40(conf)) 149 if (IS_CHAN_HT40(chan))
150 clockrate *= 2; 150 clockrate *= 2;
151 151
152 if (ah->curchan) { 152 if (ah->curchan) {
153 if (IS_CHAN_HALF_RATE(ah->curchan)) 153 if (IS_CHAN_HALF_RATE(chan))
154 clockrate /= 2; 154 clockrate /= 2;
155 if (IS_CHAN_QUARTER_RATE(ah->curchan)) 155 if (IS_CHAN_QUARTER_RATE(chan))
156 clockrate /= 4; 156 clockrate /= 4;
157 } 157 }
158 158
@@ -1038,7 +1038,6 @@ static bool ath9k_hw_set_global_txtimeout(struct ath_hw *ah, u32 tu)
1038void ath9k_hw_init_global_settings(struct ath_hw *ah) 1038void ath9k_hw_init_global_settings(struct ath_hw *ah)
1039{ 1039{
1040 struct ath_common *common = ath9k_hw_common(ah); 1040 struct ath_common *common = ath9k_hw_common(ah);
1041 struct ieee80211_conf *conf = &common->hw->conf;
1042 const struct ath9k_channel *chan = ah->curchan; 1041 const struct ath9k_channel *chan = ah->curchan;
1043 int acktimeout, ctstimeout, ack_offset = 0; 1042 int acktimeout, ctstimeout, ack_offset = 0;
1044 int slottime; 1043 int slottime;
@@ -1113,8 +1112,7 @@ void ath9k_hw_init_global_settings(struct ath_hw *ah)
1113 * BA frames in some implementations, but it has been found to fix ACK 1112 * BA frames in some implementations, but it has been found to fix ACK
1114 * timeout issues in other cases as well. 1113 * timeout issues in other cases as well.
1115 */ 1114 */
1116 if (conf->chandef.chan && 1115 if (IS_CHAN_2GHZ(chan) &&
1117 conf->chandef.chan->band == IEEE80211_BAND_2GHZ &&
1118 !IS_CHAN_HALF_RATE(chan) && !IS_CHAN_QUARTER_RATE(chan)) { 1116 !IS_CHAN_HALF_RATE(chan) && !IS_CHAN_QUARTER_RATE(chan)) {
1119 acktimeout += 64 - sifstime - ah->slottime; 1117 acktimeout += 64 - sifstime - ah->slottime;
1120 ctstimeout += 48 - sifstime - ah->slottime; 1118 ctstimeout += 48 - sifstime - ah->slottime;
@@ -2946,12 +2944,11 @@ void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set)
2946} 2944}
2947EXPORT_SYMBOL(ath9k_hw_set_tsfadjust); 2945EXPORT_SYMBOL(ath9k_hw_set_tsfadjust);
2948 2946
2949void ath9k_hw_set11nmac2040(struct ath_hw *ah) 2947void ath9k_hw_set11nmac2040(struct ath_hw *ah, struct ath9k_channel *chan)
2950{ 2948{
2951 struct ieee80211_conf *conf = &ath9k_hw_common(ah)->hw->conf;
2952 u32 macmode; 2949 u32 macmode;
2953 2950
2954 if (conf_is_ht40(conf) && !ah->config.cwm_ignore_extcca) 2951 if (IS_CHAN_HT40(chan) && !ah->config.cwm_ignore_extcca)
2955 macmode = AR_2040_JOINED_RX_CLEAR; 2952 macmode = AR_2040_JOINED_RX_CLEAR;
2956 else 2953 else
2957 macmode = 0; 2954 macmode = 0;
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 9d04d67843b2..81fcbc756122 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -1003,7 +1003,7 @@ void ath9k_hw_reset_tsf(struct ath_hw *ah);
1003void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set); 1003void ath9k_hw_set_tsfadjust(struct ath_hw *ah, bool set);
1004void ath9k_hw_init_global_settings(struct ath_hw *ah); 1004void ath9k_hw_init_global_settings(struct ath_hw *ah);
1005u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah); 1005u32 ar9003_get_pll_sqsum_dvc(struct ath_hw *ah);
1006void ath9k_hw_set11nmac2040(struct ath_hw *ah); 1006void ath9k_hw_set11nmac2040(struct ath_hw *ah, struct ath9k_channel *chan);
1007void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period); 1007void ath9k_hw_beaconinit(struct ath_hw *ah, u32 next_beacon, u32 beacon_period);
1008void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah, 1008void ath9k_hw_set_sta_beacon_timers(struct ath_hw *ah,
1009 const struct ath9k_beacon_state *bs); 1009 const struct ath9k_beacon_state *bs);