diff options
author | Sujith <Sujith.Manoharan@atheros.com> | 2009-04-13 12:26:48 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-04-22 16:54:46 -0400 |
commit | 379f04407c92d84f2506385b66fb9fc89ecd96c3 (patch) | |
tree | 369e64ee62bbe9c331fe804b433f295bebd385e1 | |
parent | 415f738ecf41b427921b503ecfd427e26f89dc23 (diff) |
ath9k: Cleanup calibration interface
This patch cleans up the functions dealing with calibration,
using proper return values.
ath9k_hw_per_calibration(), ath9k_hw_calibrate now return bool values
instead of setting error values in the function arguments.
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/ath/ath9k/calib.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/calib.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/ath/ath9k/main.c | 32 |
3 files changed, 24 insertions, 38 deletions
diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c index 3195c0b9a6a7..a0661bb96723 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c | |||
@@ -238,13 +238,12 @@ static void ath9k_hw_reset_calibration(struct ath_hw *ah, | |||
238 | ah->cal_samples = 0; | 238 | ah->cal_samples = 0; |
239 | } | 239 | } |
240 | 240 | ||
241 | static void ath9k_hw_per_calibration(struct ath_hw *ah, | 241 | static bool ath9k_hw_per_calibration(struct ath_hw *ah, |
242 | struct ath9k_channel *ichan, | 242 | struct ath9k_channel *ichan, |
243 | u8 rxchainmask, | 243 | u8 rxchainmask, |
244 | struct hal_cal_list *currCal, | 244 | struct hal_cal_list *currCal) |
245 | bool *isCalDone) | ||
246 | { | 245 | { |
247 | *isCalDone = false; | 246 | bool iscaldone = false; |
248 | 247 | ||
249 | if (currCal->calState == CAL_RUNNING) { | 248 | if (currCal->calState == CAL_RUNNING) { |
250 | if (!(REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) & | 249 | if (!(REG_READ(ah, AR_PHY_TIMING_CTRL4(0)) & |
@@ -263,7 +262,7 @@ static void ath9k_hw_per_calibration(struct ath_hw *ah, | |||
263 | currCal->calData->calPostProc(ah, numChains); | 262 | currCal->calData->calPostProc(ah, numChains); |
264 | ichan->CalValid |= currCal->calData->calType; | 263 | ichan->CalValid |= currCal->calData->calType; |
265 | currCal->calState = CAL_DONE; | 264 | currCal->calState = CAL_DONE; |
266 | *isCalDone = true; | 265 | iscaldone = true; |
267 | } else { | 266 | } else { |
268 | ath9k_hw_setup_calibration(ah, currCal); | 267 | ath9k_hw_setup_calibration(ah, currCal); |
269 | } | 268 | } |
@@ -271,6 +270,8 @@ static void ath9k_hw_per_calibration(struct ath_hw *ah, | |||
271 | } else if (!(ichan->CalValid & currCal->calData->calType)) { | 270 | } else if (!(ichan->CalValid & currCal->calData->calType)) { |
272 | ath9k_hw_reset_calibration(ah, currCal); | 271 | ath9k_hw_reset_calibration(ah, currCal); |
273 | } | 272 | } |
273 | |||
274 | return iscaldone; | ||
274 | } | 275 | } |
275 | 276 | ||
276 | /* Assumes you are talking about the currently configured channel */ | 277 | /* Assumes you are talking about the currently configured channel */ |
@@ -841,23 +842,21 @@ static inline void ath9k_hw_9285_pa_cal(struct ath_hw *ah) | |||
841 | } | 842 | } |
842 | 843 | ||
843 | bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, | 844 | bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, |
844 | u8 rxchainmask, bool longcal, | 845 | u8 rxchainmask, bool longcal) |
845 | bool *isCalDone) | ||
846 | { | 846 | { |
847 | bool iscaldone = true; | ||
847 | struct hal_cal_list *currCal = ah->cal_list_curr; | 848 | struct hal_cal_list *currCal = ah->cal_list_curr; |
848 | 849 | ||
849 | *isCalDone = true; | ||
850 | |||
851 | if (currCal && | 850 | if (currCal && |
852 | (currCal->calState == CAL_RUNNING || | 851 | (currCal->calState == CAL_RUNNING || |
853 | currCal->calState == CAL_WAITING)) { | 852 | currCal->calState == CAL_WAITING)) { |
854 | ath9k_hw_per_calibration(ah, chan, rxchainmask, currCal, | 853 | iscaldone = ath9k_hw_per_calibration(ah, chan, |
855 | isCalDone); | 854 | rxchainmask, currCal); |
856 | if (*isCalDone) { | 855 | if (iscaldone) { |
857 | ah->cal_list_curr = currCal = currCal->calNext; | 856 | ah->cal_list_curr = currCal = currCal->calNext; |
858 | 857 | ||
859 | if (currCal->calState == CAL_WAITING) { | 858 | if (currCal->calState == CAL_WAITING) { |
860 | *isCalDone = false; | 859 | iscaldone = false; |
861 | ath9k_hw_reset_calibration(ah, currCal); | 860 | ath9k_hw_reset_calibration(ah, currCal); |
862 | } | 861 | } |
863 | } | 862 | } |
@@ -877,7 +876,7 @@ bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, | |||
877 | chan->channelFlags &= ~CHANNEL_CW_INT; | 876 | chan->channelFlags &= ~CHANNEL_CW_INT; |
878 | } | 877 | } |
879 | 878 | ||
880 | return true; | 879 | return iscaldone; |
881 | } | 880 | } |
882 | 881 | ||
883 | static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan) | 882 | static bool ar9285_clc(struct ath_hw *ah, struct ath9k_channel *chan) |
diff --git a/drivers/net/wireless/ath/ath9k/calib.h b/drivers/net/wireless/ath/ath9k/calib.h index 1c74bd50700d..ac71ed966a1b 100644 --- a/drivers/net/wireless/ath/ath9k/calib.h +++ b/drivers/net/wireless/ath/ath9k/calib.h | |||
@@ -116,8 +116,7 @@ int16_t ath9k_hw_getnf(struct ath_hw *ah, | |||
116 | void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah); | 116 | void ath9k_init_nfcal_hist_buffer(struct ath_hw *ah); |
117 | s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan); | 117 | s16 ath9k_hw_getchan_noise(struct ath_hw *ah, struct ath9k_channel *chan); |
118 | bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, | 118 | bool ath9k_hw_calibrate(struct ath_hw *ah, struct ath9k_channel *chan, |
119 | u8 rxchainmask, bool longcal, | 119 | u8 rxchainmask, bool longcal); |
120 | bool *isCalDone); | ||
121 | bool ath9k_hw_init_cal(struct ath_hw *ah, | 120 | bool ath9k_hw_init_cal(struct ath_hw *ah, |
122 | struct ath9k_channel *chan); | 121 | struct ath9k_channel *chan); |
123 | 122 | ||
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c index 9564b73ded51..8bf2bf36fd6d 100644 --- a/drivers/net/wireless/ath/ath9k/main.c +++ b/drivers/net/wireless/ath/ath9k/main.c | |||
@@ -367,28 +367,16 @@ static void ath_ani_calibrate(unsigned long data) | |||
367 | 367 | ||
368 | /* Perform calibration if necessary */ | 368 | /* Perform calibration if necessary */ |
369 | if (longcal || shortcal) { | 369 | if (longcal || shortcal) { |
370 | bool iscaldone = false; | 370 | sc->ani.caldone = ath9k_hw_calibrate(ah, ah->curchan, |
371 | 371 | sc->rx_chainmask, longcal); | |
372 | if (ath9k_hw_calibrate(ah, ah->curchan, | 372 | |
373 | sc->rx_chainmask, longcal, | 373 | if (longcal) |
374 | &iscaldone)) { | 374 | sc->ani.noise_floor = ath9k_hw_getchan_noise(ah, |
375 | if (longcal) | 375 | ah->curchan); |
376 | sc->ani.noise_floor = | 376 | |
377 | ath9k_hw_getchan_noise(ah, | 377 | DPRINTF(sc, ATH_DBG_ANI," calibrate chan %u/%x nf: %d\n", |
378 | ah->curchan); | 378 | ah->curchan->channel, ah->curchan->channelFlags, |
379 | 379 | sc->ani.noise_floor); | |
380 | DPRINTF(sc, ATH_DBG_ANI, | ||
381 | "calibrate chan %u/%x nf: %d\n", | ||
382 | ah->curchan->channel, | ||
383 | ah->curchan->channelFlags, | ||
384 | sc->ani.noise_floor); | ||
385 | } else { | ||
386 | DPRINTF(sc, ATH_DBG_ANY, | ||
387 | "calibrate chan %u/%x failed\n", | ||
388 | ah->curchan->channel, | ||
389 | ah->curchan->channelFlags); | ||
390 | } | ||
391 | sc->ani.caldone = iscaldone; | ||
392 | } | 380 | } |
393 | } | 381 | } |
394 | 382 | ||