Under error condition debug functions are being called which
only have implementation when BCMDBG is defined. This result
in #ifdef BCMDBG blocks in functions. This patch fixes this by
mapping the debug functions to empty macro when BCMDBG is not
defined. This makes the calling function easier to read.
Reviewed-by: Brett Rudley <brudley@xxxxxxxxxxxx>
Reviewed-by: Roland Vossen <rvossen@xxxxxxxxxxxx>
Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx>
---
drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c | 4 +---
drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c | 16
+++++++---------
drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h | 2 ++
drivers/staging/brcm80211/include/bcmutils.h | 3 +++
4 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
index f5ca897..7bd1946 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c
@@ -1064,13 +1064,11 @@ wlc_ampdu_dotxstatus_complete(struct ampdu_info
*ampdu, struct scb *scb,
WL_ERROR("wl%d: wlc_ampdu_dotxstatus: tx phy error (0x%x)\n",
wlc->pub->unit, txs->phyerr);
-#ifdef BCMDBG
if (WL_ERROR_ON()) {
prpkt("txpkt (AMPDU)", wlc->osh, p);
wlc_print_txdesc((d11txh_t *) p->data);
- wlc_print_txstatus(txs);
}
-#endif /* BCMDBG */
+ wlc_print_txstatus(txs);
}
}
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
index 80e0415..fb05282 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.c
@@ -215,6 +215,8 @@ static bool in_send_q = false;
static const char *fifo_names[] = {
"AC_BK", "AC_BE", "AC_VI", "AC_VO", "BCMC", "ATIM" };
const char *aci_names[] = { "AC_BE", "AC_BK", "AC_VI", "AC_VO" };
+#else
+static const char fifo_names[6][0];
#endif
static const u8 acbitmap2maxprio[] = {
@@ -6332,7 +6334,6 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct
ieee80211_hw *hw,
(u16) newfragthresh;
}
}
-#if defined(BCMDBG)
} else
WL_ERROR("wl%d: %s txop invalid for rate %d\n",
wlc->pub->unit, fifo_names[queue],
@@ -6344,9 +6345,6 @@ wlc_d11hdrs_mac80211(struct wlc_info *wlc, struct
ieee80211_hw *hw,
fifo_names[queue],
phylen, wlc->fragthresh[queue],
dur, wlc->edcf_txop[ac]);
-#else
- }
-#endif
}
}
@@ -6614,11 +6612,11 @@ wlc_dotxstatus(struct wlc_info *wlc, tx_status_t
*txs, u32 frm_tx2)
mcl = ltoh16(txh->MacTxControlLow);
if (txs->phyerr) {
- WL_ERROR("phyerr 0x%x, rate 0x%x\n",
- txs->phyerr, txh->MainRates);
-#if defined(BCMDBG)
- wlc_print_txdesc(txh);
-#endif
+ if (WL_ERROR_ON()) {
+ WL_ERROR("phyerr 0x%x, rate 0x%x\n",
+ txs->phyerr, txh->MainRates);
+ wlc_print_txdesc(txh);
+ }
wlc_print_txstatus(txs);
}
diff --git a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h
b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h
index 5817a49..43aa533 100644
--- a/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h
+++ b/drivers/staging/brcm80211/brcmsmac/wlc_mac80211.h
@@ -856,6 +856,8 @@ extern void wlc_print_rxh(d11rxhdr_t *rxh);
extern void wlc_print_hdrs(struct wlc_info *wlc, const char *prefix, u8
*frame,
d11txh_t *txh, d11rxhdr_t *rxh, uint len);
extern void wlc_print_txdesc(d11txh_t *txh);
+#else
+#define wlc_print_txdesc(a)
#endif
#if defined(BCMDBG)
extern void wlc_print_dot11_mac_hdr(u8 *buf, int len);
diff --git a/drivers/staging/brcm80211/include/bcmutils.h
b/drivers/staging/brcm80211/include/bcmutils.h
index 8e7f2ea..b8c800a 100644
--- a/drivers/staging/brcm80211/include/bcmutils.h
+++ b/drivers/staging/brcm80211/include/bcmutils.h
@@ -152,7 +152,10 @@ extern struct sk_buff *pktq_mdeq(struct pktq *pq,
uint prec_bmp, int *prec_out);
#ifdef BCMDBG
extern void prpkt(const char *msg, struct osl_info *osh,
struct sk_buff *p0);
+#else
+#define prpkt(a, b, c)
#endif /* BCMDBG */
+
#define bcm_perf_enable()
#define bcmstats(fmt)
#define bcmlog(fmt, a1, a2)