Commit 72569b7b authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Kalle Valo
Browse files

ath9k: fix RX_STAT_INC() etc macros



A couple of macros that deal with statistics in ath9k rely on the
declaration of the 'sc' variable, which they dereference.

However, when the statistics are disabled, the new instance in
ath_cmn_process_fft() causes a warning for an unused variable:

drivers/net/wireless/ath/ath9k/common-spectral.c: In function 'ath_cmn_process_fft':
drivers/net/wireless/ath/ath9k/common-spectral.c:474:20: error: unused variable 'sc' [-Werror=unused-variable]

It's better if those macros only operate on their arguments instead of
known variable names, and adding a cast to (void) kills off that warning.

Fixes: 03224678 ("ath9k: add counters for good and errorneous FFT/spectral frames")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarKalle Valo <kvalo@codeaurora.org>
parent e3bfecd5
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -755,11 +755,11 @@ void ath_ant_comb_scan(struct ath_softc *sc, struct ath_rx_status *rs)
	}

	if (main_ant_conf == rx_ant_conf) {
		ANT_STAT_INC(ANT_MAIN, recv_cnt);
		ANT_LNA_INC(ANT_MAIN, rx_ant_conf);
		ANT_STAT_INC(sc, ANT_MAIN, recv_cnt);
		ANT_LNA_INC(sc, ANT_MAIN, rx_ant_conf);
	} else {
		ANT_STAT_INC(ANT_ALT, recv_cnt);
		ANT_LNA_INC(ANT_ALT, rx_ant_conf);
		ANT_STAT_INC(sc, ANT_ALT, recv_cnt);
		ANT_LNA_INC(sc, ANT_ALT, rx_ant_conf);
	}

	/* Short scan check */
+4 −4
Original line number Diff line number Diff line
@@ -624,9 +624,9 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h
						  tsf, freq, chan_type);

				if (ret == 0)
					RX_STAT_INC(rx_spectral_sample_good);
					RX_STAT_INC(sc, rx_spectral_sample_good);
				else
					RX_STAT_INC(rx_spectral_sample_err);
					RX_STAT_INC(sc, rx_spectral_sample_err);

				memset(sample_buf, 0, SPECTRAL_SAMPLE_MAX_LEN);

@@ -642,9 +642,9 @@ int ath_cmn_process_fft(struct ath_spec_scan_priv *spec_priv, struct ieee80211_h
						  tsf, freq, chan_type);

				if (ret == 0)
					RX_STAT_INC(rx_spectral_sample_good);
					RX_STAT_INC(sc, rx_spectral_sample_good);
				else
					RX_STAT_INC(rx_spectral_sample_err);
					RX_STAT_INC(sc, rx_spectral_sample_err);

				/* Mix the received bins to the /dev/random
				 * pool
+12 −12
Original line number Diff line number Diff line
@@ -785,35 +785,35 @@ void ath_debug_stat_tx(struct ath_softc *sc, struct ath_buf *bf,
{
	int qnum = txq->axq_qnum;

	TX_STAT_INC(qnum, tx_pkts_all);
	TX_STAT_INC(sc, qnum, tx_pkts_all);
	sc->debug.stats.txstats[qnum].tx_bytes_all += bf->bf_mpdu->len;

	if (bf_isampdu(bf)) {
		if (flags & ATH_TX_ERROR)
			TX_STAT_INC(qnum, a_xretries);
			TX_STAT_INC(sc, qnum, a_xretries);
		else
			TX_STAT_INC(qnum, a_completed);
			TX_STAT_INC(sc, qnum, a_completed);
	} else {
		if (ts->ts_status & ATH9K_TXERR_XRETRY)
			TX_STAT_INC(qnum, xretries);
			TX_STAT_INC(sc, qnum, xretries);
		else
			TX_STAT_INC(qnum, completed);
			TX_STAT_INC(sc, qnum, completed);
	}

	if (ts->ts_status & ATH9K_TXERR_FILT)
		TX_STAT_INC(qnum, txerr_filtered);
		TX_STAT_INC(sc, qnum, txerr_filtered);
	if (ts->ts_status & ATH9K_TXERR_FIFO)
		TX_STAT_INC(qnum, fifo_underrun);
		TX_STAT_INC(sc, qnum, fifo_underrun);
	if (ts->ts_status & ATH9K_TXERR_XTXOP)
		TX_STAT_INC(qnum, xtxop);
		TX_STAT_INC(sc, qnum, xtxop);
	if (ts->ts_status & ATH9K_TXERR_TIMER_EXPIRED)
		TX_STAT_INC(qnum, timer_exp);
		TX_STAT_INC(sc, qnum, timer_exp);
	if (ts->ts_flags & ATH9K_TX_DESC_CFG_ERR)
		TX_STAT_INC(qnum, desc_cfg_err);
		TX_STAT_INC(sc, qnum, desc_cfg_err);
	if (ts->ts_flags & ATH9K_TX_DATA_UNDERRUN)
		TX_STAT_INC(qnum, data_underrun);
		TX_STAT_INC(sc, qnum, data_underrun);
	if (ts->ts_flags & ATH9K_TX_DELIM_UNDERRUN)
		TX_STAT_INC(qnum, delim_underrun);
		TX_STAT_INC(sc, qnum, delim_underrun);
}

void ath_debug_stat_rx(struct ath_softc *sc, struct ath_rx_status *rs)
+10 −10
Original line number Diff line number Diff line
@@ -25,17 +25,17 @@ struct ath_buf;
struct fft_sample_tlv;

#ifdef CONFIG_ATH9K_DEBUGFS
#define TX_STAT_INC(q, c) sc->debug.stats.txstats[q].c++
#define RX_STAT_INC(c) (sc->debug.stats.rxstats.c++)
#define RESET_STAT_INC(sc, type) sc->debug.stats.reset[type]++
#define ANT_STAT_INC(i, c) sc->debug.stats.ant_stats[i].c++
#define ANT_LNA_INC(i, c) sc->debug.stats.ant_stats[i].lna_recv_cnt[c]++;
#define TX_STAT_INC(sc, q, c)	 do { (sc)->debug.stats.txstats[q].c++; } while (0)
#define RX_STAT_INC(sc, c)	 do { (sc)->debug.stats.rxstats.c++; } while (0)
#define RESET_STAT_INC(sc, type) do { (sc)->debug.stats.reset[type]++; } while (0)
#define ANT_STAT_INC(sc, i, c)	 do { (sc)->debug.stats.ant_stats[i].c++; } while (0)
#define ANT_LNA_INC(sc, i, c)	 do { (sc)->debug.stats.ant_stats[i].lna_recv_cnt[c]++; } while (0)
#else
#define TX_STAT_INC(q, c) do { } while (0)
#define RX_STAT_INC(c)
#define RESET_STAT_INC(sc, type) do { } while (0)
#define ANT_STAT_INC(i, c) do { } while (0)
#define ANT_LNA_INC(i, c) do { } while (0)
#define TX_STAT_INC(sc, q, c)	 do { (void)(sc); } while (0)
#define RX_STAT_INC(sc, c)	 do { (void)(sc); } while (0)
#define RESET_STAT_INC(sc, type) do { (void)(sc); } while (0)
#define ANT_STAT_INC(sc, i, c)	 do { (void)(sc); } while (0)
#define ANT_LNA_INC(sc, i, c)	 do { (void)(sc); } while (0)
#endif

enum ath_reset_type {
+1 −1
Original line number Diff line number Diff line
@@ -809,7 +809,7 @@ static void ath9k_tx(struct ieee80211_hw *hw,

	if (ath_tx_start(hw, skb, &txctl) != 0) {
		ath_dbg(common, XMIT, "TX failed\n");
		TX_STAT_INC(txctl.txq->axq_qnum, txfailed);
		TX_STAT_INC(sc, txctl.txq->axq_qnum, txfailed);
		goto exit;
	}

Loading