ath5k: optimize ath5k_hw_calibration_poll
authorBruno Randolf <br1@einfach.org>
Thu, 25 Mar 2010 05:49:14 +0000 (14:49 +0900)
committerJohn W. Linville <linville@tuxdriver.com>
Wed, 31 Mar 2010 18:39:09 +0000 (14:39 -0400)
Optimize ath5k_hw_calibration_poll() since it is called on every singe
interrupt.

Signed-off-by: Bruno Randolf <br1@einfach.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath/ath5k/ath5k.h
drivers/net/wireless/ath/ath5k/phy.c

index d84ccde11171672f766f2413e47e95f7154e3513..3f56d9ee21de2aae11ea1955448a674cdf9b3ab5 100644 (file)
@@ -1100,7 +1100,7 @@ struct ath5k_hw {
        s32                     ah_noise_floor;
 
        /* Calibration timestamp */
-       unsigned long           ah_cal_tstamp;
+       unsigned long           ah_cal_next_full;
 
        /* Calibration mask */
        u8                      ah_cal_mask;
index 075873f9842881e22f4b58a321c8e1c4a6a6f94e..69053bfebbb974cf70891d5e8e26bde76f14eb1f 100644 (file)
@@ -1105,22 +1105,14 @@ int ath5k_hw_channel(struct ath5k_hw *ah, struct ieee80211_channel *channel)
 void
 ath5k_hw_calibration_poll(struct ath5k_hw *ah)
 {
-       /* Calibration interval in jiffies */
-       unsigned long cal_intval;
-
-       cal_intval = msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL);
-
-       /* Initialize timestamp if needed */
-       if (!ah->ah_cal_tstamp)
-               ah->ah_cal_tstamp = jiffies;
-
-       /* For now we always do full calibration
-        * Mark software interrupt mask and fire software
-        * interrupt (bit gets auto-cleared) */
-       if (time_is_before_eq_jiffies(ah->ah_cal_tstamp + cal_intval)) {
-               ah->ah_cal_tstamp = jiffies;
+       if (time_is_before_eq_jiffies(ah->ah_cal_next_full)) {
+               ah->ah_cal_next_full = jiffies +
+                       msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_FULL);
                tasklet_schedule(&ah->ah_sc->calib);
        }
+       /* we could use SWI to generate enough interrupts to meet our
+        * calibration interval requirements, if necessary:
+        * AR5K_REG_ENABLE_BITS(ah, AR5K_CR, AR5K_CR_SWI); */
 }
 
 static int sign_extend(int val, const int nbits)