From: Sujith <Sujith.Manoharan@atheros.com>
Date: Tue, 2 Dec 2008 13:07:54 +0000 (+0530)
Subject: ath9k: Choose correct ANI calibration period
X-Git-Tag: firefly_0821_release~16481^2~305^2~23
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=aac9207e45b1ec1f36d67e57d94f59ac036d37ee;p=firefly-linux-kernel-4.4.55.git

ath9k: Choose correct ANI calibration period

ANI can't be turned on/off dynamically yet, but the calculation
of the calibration period is wrong anyway. This patch fixes it.

Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Sujith <Sujith.Manoharan@atheros.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
---

diff --git a/drivers/net/wireless/ath9k/main.c b/drivers/net/wireless/ath9k/main.c
index 3d7111e9b8d8..26c47577e183 100644
--- a/drivers/net/wireless/ath9k/main.c
+++ b/drivers/net/wireless/ath9k/main.c
@@ -421,8 +421,9 @@ static void ath_ani_calibrate(unsigned long data)
 	* The interval must be the shortest necessary to satisfy ANI,
 	* short calibration and long calibration.
 	*/
-
-	cal_interval = ATH_ANI_POLLINTERVAL;
+	cal_interval = ATH_LONG_CALINTERVAL;
+	if (sc->sc_ah->ah_config.enable_ani)
+		cal_interval = min(cal_interval, (u32)ATH_ANI_POLLINTERVAL);
 	if (!sc->sc_ani.sc_caldone)
 		cal_interval = min(cal_interval, (u32)ATH_SHORT_CALINTERVAL);