ath5k: use DECLARE_EWMA
authorJohannes Berg <johannes.berg@intel.com>
Wed, 19 Aug 2015 07:46:20 +0000 (09:46 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 20 Aug 2015 21:10:22 +0000 (14:10 -0700)
This reduces code size slightly (at least on x86/64) while also
removing memory consumption by two unsigned long values for each
ath5k device.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/wireless/ath/ath5k/Kconfig
drivers/net/wireless/ath/ath5k/ani.c
drivers/net/wireless/ath/ath5k/ath5k.h
drivers/net/wireless/ath/ath5k/base.c
drivers/net/wireless/ath/ath5k/debug.c

index 2399a39217625e55c9a52551263e3b9058d144c5..b1278f9f24baee8ba4c08a107d1c3d2ca5432c03 100644 (file)
@@ -5,7 +5,6 @@ config ATH5K
        select MAC80211_LEDS
        select LEDS_CLASS
        select NEW_LEDS
-       select AVERAGE
        select ATH5K_AHB if ATH25
        select ATH5K_PCI if !ATH25
        ---help---
index 5c008757662b50e05b63024a2e293bfd1a30d671..38be2702c0e23a485f886315a3d5966c13ba3848 100644 (file)
@@ -223,7 +223,7 @@ static void
 ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,
                         bool ofdm_trigger)
 {
-       int rssi = ewma_read(&ah->ah_beacon_rssi_avg);
+       int rssi = ewma_beacon_rssi_read(&ah->ah_beacon_rssi_avg);
 
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "raise immunity (%s)",
                ofdm_trigger ? "ODFM" : "CCK");
@@ -309,7 +309,7 @@ ath5k_ani_raise_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as,
 static void
 ath5k_ani_lower_immunity(struct ath5k_hw *ah, struct ath5k_ani_state *as)
 {
-       int rssi = ewma_read(&ah->ah_beacon_rssi_avg);
+       int rssi = ewma_beacon_rssi_read(&ah->ah_beacon_rssi_avg);
 
        ATH5K_DBG_UNLIMIT(ah, ATH5K_DEBUG_ANI, "lower immunity");
 
index e22b0e778927155ed693ad84c177b9a6c8d03715..fa6e89e5c4213dbb76da4a5ef2b780550cd6b954 100644 (file)
@@ -1252,6 +1252,8 @@ struct ath5k_statistics {
 #define ATH5K_TXQ_LEN_MAX      (ATH_TXBUF / 4)         /* bufs per queue */
 #define ATH5K_TXQ_LEN_LOW      (ATH5K_TXQ_LEN_MAX / 2) /* low mark */
 
+DECLARE_EWMA(beacon_rssi, 1024, 8)
+
 /* Driver state associated with an instance of a device */
 struct ath5k_hw {
        struct ath_common       common;
@@ -1432,7 +1434,7 @@ struct ath5k_hw {
        struct ath5k_nfcal_hist ah_nfcal_hist;
 
        /* average beacon RSSI in our BSS (used by ANI) */
-       struct ewma             ah_beacon_rssi_avg;
+       struct ewma_beacon_rssi ah_beacon_rssi_avg;
 
        /* noise floor from last periodic calibration */
        s32                     ah_noise_floor;
index 23552f43d1253dd81de3e4f7f6f400a14bff2bd4..342563a3706f403b445a24028f19b059ccd6285a 100644 (file)
@@ -1430,7 +1430,7 @@ ath5k_receive_frame(struct ath5k_hw *ah, struct sk_buff *skb,
        trace_ath5k_rx(ah, skb);
 
        if (ath_is_mybeacon(common, (struct ieee80211_hdr *)skb->data)) {
-               ewma_add(&ah->ah_beacon_rssi_avg, rs->rs_rssi);
+               ewma_beacon_rssi_add(&ah->ah_beacon_rssi_avg, rs->rs_rssi);
 
                /* check beacons in IBSS mode */
                if (ah->opmode == NL80211_IFTYPE_ADHOC)
@@ -2936,7 +2936,7 @@ ath5k_reset(struct ath5k_hw *ah, struct ieee80211_channel *chan,
        ah->ah_cal_next_short = jiffies +
                msecs_to_jiffies(ATH5K_TUNE_CALIBRATION_INTERVAL_SHORT);
 
-       ewma_init(&ah->ah_beacon_rssi_avg, 1024, 8);
+       ewma_beacon_rssi_init(&ah->ah_beacon_rssi_avg);
 
        /* clear survey data and cycle counters */
        memset(&ah->survey, 0, sizeof(ah->survey));
index c70782e8f07bd704b2ff495339eb5ab6b65864bc..654a1e33f8278743fdb6034e1681b2a3e4aa8515 100644 (file)
@@ -722,7 +722,7 @@ static ssize_t read_file_ani(struct file *file, char __user *user_buf,
                        st->mib_intr);
        len += snprintf(buf + len, sizeof(buf) - len,
                        "beacon RSSI average:\t%d\n",
-                       (int)ewma_read(&ah->ah_beacon_rssi_avg));
+                       (int)ewma_beacon_rssi_read(&ah->ah_beacon_rssi_avg));
 
 #define CC_PRINT(_struct, _field) \
        _struct._field, \