OSDN Git Service

ath9k: fix RX_STAT_INC() etc macros
authorArnd Bergmann <arnd@arndb.de>
Tue, 9 Oct 2018 16:03:06 +0000 (18:03 +0200)
committerKalle Valo <kvalo@codeaurora.org>
Sat, 13 Oct 2018 17:27:35 +0000 (20:27 +0300)
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: 03224678c013 ("ath9k: add counters for good and errorneous FFT/spectral frames")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
drivers/net/wireless/ath/ath9k/antenna.c
drivers/net/wireless/ath/ath9k/common-spectral.c
drivers/net/wireless/ath/ath9k/debug.c
drivers/net/wireless/ath/ath9k/debug.h
drivers/net/wireless/ath/ath9k/main.c
drivers/net/wireless/ath/ath9k/recv.c
drivers/net/wireless/ath/ath9k/xmit.c

index a366843..988222c 100644 (file)
@@ -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 */
index 6a43d26..6aa3ec0 100644 (file)
@@ -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
index c871b7e..4399e9a 100644 (file)
@@ -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)
index 249f814..79607db 100644 (file)
@@ -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 {
index c85f613..1e3b5f4 100644 (file)
@@ -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;
        }
 
index a8ac42c..30d1bd8 100644 (file)
@@ -829,7 +829,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
         * Discard zero-length packets and packets smaller than an ACK
         */
        if (rx_stats->rs_datalen < 10) {
-               RX_STAT_INC(rx_len_err);
+               RX_STAT_INC(sc, rx_len_err);
                goto corrupt;
        }
 
@@ -839,7 +839,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
         * those frames.
         */
        if (rx_stats->rs_datalen > (common->rx_bufsize - ah->caps.rx_status_len)) {
-               RX_STAT_INC(rx_len_err);
+               RX_STAT_INC(sc, rx_len_err);
                goto corrupt;
        }
 
@@ -880,7 +880,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
                } else if (sc->spec_priv.spectral_mode != SPECTRAL_DISABLED &&
                           ath_cmn_process_fft(&sc->spec_priv, hdr, rx_stats,
                                               rx_status->mactime)) {
-                       RX_STAT_INC(rx_spectral);
+                       RX_STAT_INC(sc, rx_spectral);
                }
                return -EINVAL;
        }
@@ -898,7 +898,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
        spin_unlock_bh(&sc->chan_lock);
 
        if (ath_is_mybeacon(common, hdr)) {
-               RX_STAT_INC(rx_beacons);
+               RX_STAT_INC(sc, rx_beacons);
                rx_stats->is_mybeacon = true;
        }
 
@@ -915,7 +915,7 @@ static int ath9k_rx_skb_preprocess(struct ath_softc *sc,
                 */
                ath_dbg(common, ANY, "unsupported hw bitrate detected 0x%02x using 1 Mbit\n",
                        rx_stats->rs_rate);
-               RX_STAT_INC(rx_rate_err);
+               RX_STAT_INC(sc, rx_rate_err);
                return -EINVAL;
        }
 
@@ -1136,7 +1136,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
                 * skb and put it at the tail of the sc->rx.rxbuf list for
                 * processing. */
                if (!requeue_skb) {
-                       RX_STAT_INC(rx_oom_err);
+                       RX_STAT_INC(sc, rx_oom_err);
                        goto requeue_drop_frag;
                }
 
@@ -1164,7 +1164,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
                                                     rxs, decrypt_error);
 
                if (rs.rs_more) {
-                       RX_STAT_INC(rx_frags);
+                       RX_STAT_INC(sc, rx_frags);
                        /*
                         * rs_more indicates chained descriptors which can be
                         * used to link buffers together for a sort of
@@ -1174,7 +1174,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
                                /* too many fragments - cannot handle frame */
                                dev_kfree_skb_any(sc->rx.frag);
                                dev_kfree_skb_any(skb);
-                               RX_STAT_INC(rx_too_many_frags_err);
+                               RX_STAT_INC(sc, rx_too_many_frags_err);
                                skb = NULL;
                        }
                        sc->rx.frag = skb;
@@ -1186,7 +1186,7 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush, bool hp)
 
                        if (pskb_expand_head(hdr_skb, 0, space, GFP_ATOMIC) < 0) {
                                dev_kfree_skb(skb);
-                               RX_STAT_INC(rx_oom_err);
+                               RX_STAT_INC(sc, rx_oom_err);
                                goto requeue_drop_frag;
                        }
 
index 43b6c85..25b3fc8 100644 (file)
@@ -391,7 +391,7 @@ static void ath_tx_set_retry(struct ath_softc *sc, struct ath_txq *txq,
        struct ieee80211_hdr *hdr;
        int prev = fi->retries;
 
-       TX_STAT_INC(txq->axq_qnum, a_retries);
+       TX_STAT_INC(sc, txq->axq_qnum, a_retries);
        fi->retries += count;
 
        if (prev > 0)
@@ -1105,7 +1105,7 @@ finish:
                al = get_frame_info(bf->bf_mpdu)->framelen;
                bf->bf_state.bf_type = BUF_AMPDU;
        } else {
-               TX_STAT_INC(txq->axq_qnum, a_aggr);
+               TX_STAT_INC(sc, txq->axq_qnum, a_aggr);
        }
 
        return al;
@@ -1727,7 +1727,7 @@ void ath9k_release_buffered_frames(struct ieee80211_hw *hw,
                        bf_tail = bf;
                        nframes--;
                        sent++;
-                       TX_STAT_INC(txq->axq_qnum, a_queued_hw);
+                       TX_STAT_INC(sc, txq->axq_qnum, a_queued_hw);
 
                        if (an->sta && skb_queue_empty(&tid->retry_q))
                                ieee80211_sta_set_buffered(an->sta, i, false);
@@ -2110,14 +2110,14 @@ static void ath_tx_txqaddbuf(struct ath_softc *sc, struct ath_txq *txq,
        }
 
        if (puttxbuf) {
-               TX_STAT_INC(txq->axq_qnum, puttxbuf);
+               TX_STAT_INC(sc, txq->axq_qnum, puttxbuf);
                ath9k_hw_puttxbuf(ah, txq->axq_qnum, bf->bf_daddr);
                ath_dbg(common, XMIT, "TXDP[%u] = %llx (%p)\n",
                        txq->axq_qnum, ito64(bf->bf_daddr), bf->bf_desc);
        }
 
        if (!edma || sc->tx99_state) {
-               TX_STAT_INC(txq->axq_qnum, txstart);
+               TX_STAT_INC(sc, txq->axq_qnum, txstart);
                ath9k_hw_txstart(ah, txq->axq_qnum);
        }
 
@@ -2154,7 +2154,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
        bf->bf_lastbf = bf;
        ath_tx_fill_desc(sc, bf, txq, fi->framelen);
        ath_tx_txqaddbuf(sc, txq, &bf_head, false);
-       TX_STAT_INC(txq->axq_qnum, queued);
+       TX_STAT_INC(sc, txq->axq_qnum, queued);
 }
 
 static void setup_frame_info(struct ieee80211_hw *hw,
@@ -2486,7 +2486,7 @@ void ath_tx_cabq(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
        ath_txq_lock(sc, txctl.txq);
        ath_tx_fill_desc(sc, bf, txctl.txq, 0);
        ath_tx_txqaddbuf(sc, txctl.txq, &bf_q, false);
-       TX_STAT_INC(txctl.txq->axq_qnum, queued);
+       TX_STAT_INC(sc, txctl.txq->axq_qnum, queued);
        ath_txq_unlock(sc, txctl.txq);
 }
 
@@ -2699,7 +2699,7 @@ static void ath_tx_processq(struct ath_softc *sc, struct ath_txq *txq)
                if (status == -EINPROGRESS)
                        break;
 
-               TX_STAT_INC(txq->axq_qnum, txprocdesc);
+               TX_STAT_INC(sc, txq->axq_qnum, txprocdesc);
 
                /*
                 * Remove ath_buf's of the same transmit unit from txq,
@@ -2778,7 +2778,7 @@ void ath_tx_edma_tasklet(struct ath_softc *sc)
 
                ath_txq_lock(sc, txq);
 
-               TX_STAT_INC(txq->axq_qnum, txprocdesc);
+               TX_STAT_INC(sc, txq->axq_qnum, txprocdesc);
 
                fifo_list = &txq->txq_fifo[txq->txq_tailidx];
                if (list_empty(fifo_list)) {