Skip to contentSkip to conversation

staging: brcm80211: message logging macro cleanup

PATCH New Roland Vossen 1 participant 4 messages Apr 19, 2011 Staging

lore
Share & tools
lore
#1 lore raw

PATCH 1/3 staging: brcm80211: replaced WL_TRACE by BCMMSG

In reply to Roland Vossen

Code cleanup. Make code more readable by converting different macro's (WL_TRACE, WL_AMPDU, etc) into one BCMMSG. This single macro uses dev_err() instead of printk(), so the user is able to correlate a log message to our driver. This patch only replaces WL_TRACE, subsequent patches will replace WL_AMPDU etc.

---
 drivers/staging/brcm80211/brcmsmac/wl_dbg.h      |   15 ++-
 drivers/staging/brcm80211/brcmsmac/wl_mac80211.c |   18 ++--
 drivers/staging/brcm80211/brcmsmac/wlc_bmac.c    |  104 +++++++++++-----------
 drivers/staging/brcm80211/brcmsmac/wlc_channel.c |    2 +-
 drivers/staging/brcm80211/brcmsmac/wlc_main.c    |   62 +++++++-------
 drivers/staging/brcm80211/brcmsmac/wlc_stf.c     |    6 +-
 6 files changed, 105 insertions(+), 102 deletions(-)
drivers/staging/brcm80211/brcmsmac/wl_dbg.h +10 -5
index bdc0f85..5e58f5e 100644
@@ -17,6 +17,8 @@
 #ifndef _wl_dbg_h_
 #define _wl_dbg_h_
 
+#include <linux/device.h>			/* dev_err() */
+
 /* wl_msg_level is a bit vector with defs in wlioctl.h */
 extern u32 wl_msg_level;
 
@@ -26,14 +28,17 @@ do {						\
 		printk(fmt, ##args);		\
 } while (0)
 
+#define BCMMSG(dev, fmt, args...)		\
+do {						\
+	if (wl_msg_level & WL_TRACE_VAL)	\
+		dev_err(dev, "%s: " fmt, __func__, ##args);	\
+} while (0)
+
 #ifdef BCMDBG
 
-#define	WL_TRACE(fmt, args...)	WL_PRINT(WL_TRACE_VAL, fmt, ##args)
 #define WL_AMPDU(fmt, args...)	WL_PRINT(WL_AMPDU_VAL, fmt, ##args)
 #define WL_FFPLD(fmt, args...)	WL_PRINT(WL_FFPLD_VAL, fmt, ##args)
 
-#define WL_ERROR_ON()		(wl_msg_level & WL_ERROR_VAL)
-
 /* Extra message control for AMPDU debugging */
 #define   WL_AMPDU_UPDN_VAL	0x00000001	/* Config up/down related  */
 #define   WL_AMPDU_ERR_VAL	0x00000002	/* Calls to beaocn update  */
@@ -79,8 +84,6 @@ do {						\
 #define WL_AMPDU(fmt, args...)		no_printk(fmt, ##args)
 #define WL_FFPLD(fmt, args...)		no_printk(fmt, ##args)
 
-#define WL_ERROR_ON()		0
-
 #define WL_AMPDU_UPDN(fmt, args...)	no_printk(fmt, ##args)
 #define WL_AMPDU_RX(fmt, args...)	no_printk(fmt, ##args)
 #define WL_AMPDU_ERR(fmt, args...)	no_printk(fmt, ##args)
@@ -95,4 +98,6 @@ do {						\
 
 #endif				/* BCMDBG */
 
+#define WL_ERROR_ON()		(wl_msg_level & WL_ERROR_VAL)
+
 #endif				/* _wl_dbg_h_ */
drivers/staging/brcm80211/brcmsmac/wl_mac80211.c +8 -10
index 6ea747f..43938f4 100644
@@ -787,7 +787,7 @@ static struct wl_info *wl_attach(u16 vendor, u16 device, unsigned long regs,
 		/* Do nothing */
 	} else {
 		bustype = PCI_BUS;
-		WL_TRACE("force to PCI\n");
+		BCMMSG(wl->dev, "force to PCI\n");
 	}
 	wl->bcm_bustype = bustype;
 
@@ -1130,9 +1130,9 @@ wl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	struct ieee80211_hw *hw;
 	u32 val;
 
-	WL_TRACE("%s: bus %d slot %d func %d irq %d\n",
-		 __func__, pdev->bus->number, PCI_SLOT(pdev->devfn),
-		 PCI_FUNC(pdev->devfn), pdev->irq);
+	BCMMSG(&pdev->dev, "bus %d slot %d func %d irq %d\n",
+	       pdev->bus->number, PCI_SLOT(pdev->devfn),
+	       PCI_FUNC(pdev->devfn), pdev->irq);
 
 	if ((pdev->vendor != PCI_VENDOR_ID_BROADCOM) ||
 	    (((pdev->device & 0xff00) != 0x4300) &&
@@ -1181,7 +1181,7 @@ static int wl_suspend(struct pci_dev *pdev, pm_message_t state)
 	struct wl_info *wl;
 	struct ieee80211_hw *hw;
 
-	WL_TRACE("wl: wl_suspend\n");
+	BCMMSG(&pdev->dev, "\n");
 
 	hw = pci_get_drvdata(pdev);
 	wl = HW_TO_WL(hw);
@@ -1208,7 +1208,7 @@ static int wl_resume(struct pci_dev *pdev)
 	int err = 0;
 	u32 val;
 
-	WL_TRACE("wl: wl_resume\n");
+	BCMMSG(&pdev->dev, "wl:\n");
 	hw = pci_get_drvdata(pdev);
 	wl = HW_TO_WL(hw);
 	if (!wl) {
@@ -1441,8 +1441,7 @@ void wl_txflowcontrol(struct wl_info *wl, struct wl_if *wlif, bool state,
  */
 void wl_init(struct wl_info *wl)
 {
-	WL_TRACE("wl%d: wl_init\n", wl->pub->unit);
-
+	BCMMSG(&WL_TO_HW(wl)->wiphy->dev, "wl%d\n", wl->pub->unit);
 	wl_reset(wl);
 
 	wlc_init(wl->wlc);
@@ -1453,8 +1452,7 @@ void wl_init(struct wl_info *wl)
  */
 uint wl_reset(struct wl_info *wl)
 {
-	WL_TRACE("wl%d: wl_reset\n", wl->pub->unit);
-
+	BCMMSG(&WL_TO_HW(wl)->wiphy->dev, "wl%d\n", wl->pub->unit);
 	wlc_reset(wl->wlc);
 
 	/* dpc will not be rescheduled */
drivers/staging/brcm80211/brcmsmac/wlc_bmac.c +52 -52

338 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/wlc_channel.c +1 -1
index 55a741b..fea71ec 100644
@@ -631,7 +631,7 @@ wlc_cm_info_t *wlc_channel_mgr_attach(struct wlc_info *wlc)
 	struct wlc_pub *pub = wlc->pub;
 	char *ccode;
 
-	WL_TRACE("wl%d: wlc_channel_mgr_attach\n", wlc->pub->unit);
+	BCMMSG(wlc->dev, "wl%d\n", wlc->pub->unit);
 
 	wlc_cm = kzalloc(sizeof(wlc_cm_info_t), GFP_ATOMIC);
 	if (wlc_cm == NULL) {
drivers/staging/brcm80211/brcmsmac/wlc_main.c +31 -31

212 lines not on this page · raw message

drivers/staging/brcm80211/brcmsmac/wlc_stf.c +3 -3
index c58ab68..97f9b4d 100644
@@ -190,8 +190,8 @@ bool wlc_stf_stbc_rx_set(struct wlc_info *wlc, s32 int_val)
 
 static int wlc_stf_txcore_set(struct wlc_info *wlc, u8 Nsts, u8 core_mask)
 {
-	WL_TRACE("wl%d: %s: Nsts %d core_mask %x\n",
-		 wlc->pub->unit, __func__, Nsts, core_mask);
+	BCMMSG(wlc->dev, "wl%d: Nsts %d core_mask %x\n",
+		 wlc->pub->unit, Nsts, core_mask);
 
 	if (WLC_BITSCNT(core_mask) > wlc->stf->txstreams) {
 		core_mask = 0;
@@ -226,7 +226,7 @@ static int wlc_stf_spatial_policy_set(struct wlc_info *wlc, int val)
 	int i;
 	u8 core_mask = 0;
 
-	WL_TRACE("wl%d: %s: val %x\n", wlc->pub->unit, __func__, val);
+	BCMMSG(wlc->dev, "wl%d: val %x\n", wlc->pub->unit, val);
 
 	wlc->stf->spatial_policy = (s8) val;
 	for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) {
Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/3 staging: brcm80211: got rid of WL_FFPLD message log macro

In reply to Roland Vossen

Code cleanup. Partially removed, remaining replaced with BCMMSG.

---
 drivers/staging/brcm80211/brcmsmac/wl_dbg.h    |    8 --------
 drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c |   13 ++++++-------
 drivers/staging/brcm80211/include/wlioctl.h    |    2 --
 3 files changed, 6 insertions(+), 17 deletions(-)
drivers/staging/brcm80211/brcmsmac/wl_dbg.h +0 -8
index d95f8a9..2e8948f 100644
@@ -22,12 +22,6 @@
 /* wl_msg_level is a bit vector with defs in wlioctl.h */
 extern u32 wl_msg_level;
 
-#define WL_PRINT(level, fmt, args...)		\
-do {						\
-	if (wl_msg_level & level)		\
-		printk(fmt, ##args);		\
-} while (0)
-
 #define BCMMSG(dev, fmt, args...)		\
 do {						\
 	if (wl_msg_level & WL_TRACE_VAL)	\
@@ -36,7 +30,6 @@ do {						\
 
 #ifdef BCMDBG
 
-#define WL_FFPLD(fmt, args...)	WL_PRINT(WL_FFPLD_VAL, fmt, ##args)
 
 /* Extra message control for AMPDU debugging */
 #define   WL_AMPDU_UPDN_VAL	0x00000001	/* Config up/down related  */
@@ -79,7 +72,6 @@ do {						\
 
 #else				/* BCMDBG */
 
-#define WL_FFPLD(fmt, args...)		no_printk(fmt, ##args)
 
 #define WL_AMPDU_UPDN(fmt, args...)	no_printk(fmt, ##args)
 #define WL_AMPDU_RX(fmt, args...)	no_printk(fmt, ##args)
drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c +6 -7
index d306bf7..f217cd8 100644
@@ -315,7 +315,7 @@ static int wlc_ffpld_check_txfunfl(struct wlc_info *wlc, int fid)
 			 M_UCODE_MACSTAT + offsetof(macstat_t, txfunfl[fid]));
 	new_txunfl = (u16) (cur_txunfl - fifo->prev_txfunfl);
 	if (new_txunfl == 0) {
-		WL_FFPLD("check_txunfl : TX status FRAG set but no tx underflows\n");
+		BCMMSG(wlc->dev, "TX status FRAG set but no tx underflows\n");
 		return -1;
 	}
 	fifo->prev_txfunfl = cur_txunfl;
@@ -325,7 +325,6 @@ static int wlc_ffpld_check_txfunfl(struct wlc_info *wlc, int fid)
 
 	/* check if fifo is big enough */
 	if (wlc_xmtfifo_sz_get(wlc, fid, &xmtfifo_sz)) {
-		WL_FFPLD("check_txunfl : get xmtfifo_sz failed\n");
 		return -1;
 	}
 
@@ -339,8 +338,8 @@ static int wlc_ffpld_check_txfunfl(struct wlc_info *wlc, int fid)
 	if (fifo->accum_txfunfl < 10)
 		return 0;
 
-	WL_FFPLD("ampdu_count %d  tx_underflows %d\n",
-		 current_ampdu_cnt, fifo->accum_txfunfl);
+	BCMMSG(wlc->dev, "ampdu_count %d  tx_underflows %d\n",
+		current_ampdu_cnt, fifo->accum_txfunfl);
 
 	/*
 	   compute the current ratio of tx unfl per ampdu.
@@ -367,7 +366,6 @@ static int wlc_ffpld_check_txfunfl(struct wlc_info *wlc, int fid)
 	 */
 
 	if (fifo->ampdu_pld_size >= max_mpdu * FFPLD_MPDU_SIZE) {
-		WL_FFPLD(("tx fifo pld : max ampdu fits in fifo\n)"));
 		fifo->accum_txfunfl = 0;
 		return 0;
 	}
@@ -393,8 +391,9 @@ static int wlc_ffpld_check_txfunfl(struct wlc_info *wlc, int fid)
 		      (max_mpdu * FFPLD_MPDU_SIZE - fifo->ampdu_pld_size))
 		     / (max_mpdu * FFPLD_MPDU_SIZE)) * 100;
 
-		WL_FFPLD("DMA estimated transfer rate %d; pre-load size %d\n",
-			 fifo->dmaxferrate, fifo->ampdu_pld_size);
+		BCMMSG(wlc->dev, "DMA estimated transfer rate %d; "
+			"pre-load size %d\n",
+			fifo->dmaxferrate, fifo->ampdu_pld_size);
 	} else {
 
 		/* decrease ampdu size */
drivers/staging/brcm80211/include/wlioctl.h +0 -2
index 5e2b11b..1e11c42 100644
@@ -1247,8 +1247,6 @@ typedef struct tx_inst_power {
 /* Message levels */
 #define WL_ERROR_VAL		0x00000001
 #define WL_TRACE_VAL		0x00000002
-#define WL_AMPDU_VAL		0x20000000
-#define WL_FFPLD_VAL		0x40000000
 
 /* maximum channels returned by the get valid channels iovar */
 #define WL_NUMCHANNELS		64
Signature · 1 line
1.7.1
#0 lore raw

cover staging: brcm80211: message logging macro cleanup

Code cleanup.

Roland Vossen (3):
staging: brcm80211: replaced WL_TRACE by BCMMSG
staging: brcm80211: replaced WL_AMPDU_* with BCMMSG
staging: brcm80211: got rid of WL_FFPLD message log macro

 drivers/staging/brcm80211/brcmsmac/wl_dbg.h      |   20 ++---
 drivers/staging/brcm80211/brcmsmac/wl_mac80211.c |   18 ++--
 drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c   |   63 ++++++--------
 drivers/staging/brcm80211/brcmsmac/wlc_bmac.c    |  104 +++++++++++-----------
 drivers/staging/brcm80211/brcmsmac/wlc_channel.c |    2 +-
 drivers/staging/brcm80211/brcmsmac/wlc_main.c    |   62 +++++++-------
 drivers/staging/brcm80211/brcmsmac/wlc_stf.c     |    6 +-
 drivers/staging/brcm80211/include/wlioctl.h      |    2 -
 8 files changed, 128 insertions(+), 149 deletions(-)
#2 lore raw

PATCH 2/3 staging: brcm80211: replaced WL_AMPDU_* with BCMMSG

---
 drivers/staging/brcm80211/brcmsmac/wl_dbg.h    |    3 -
 drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c |   50 +++++++++--------------
 2 files changed, 20 insertions(+), 33 deletions(-)
drivers/staging/brcm80211/brcmsmac/wl_dbg.h +0 -3
index 5e58f5e..d95f8a9 100644
@@ -36,7 +36,6 @@ do {						\
 
 #ifdef BCMDBG
 
-#define WL_AMPDU(fmt, args...)	WL_PRINT(WL_AMPDU_VAL, fmt, ##args)
 #define WL_FFPLD(fmt, args...)	WL_PRINT(WL_FFPLD_VAL, fmt, ##args)
 
 /* Extra message control for AMPDU debugging */
@@ -80,8 +79,6 @@ do {						\
 
 #else				/* BCMDBG */
 
-#define	WL_TRACE(fmt, args...)		no_printk(fmt, ##args)
-#define WL_AMPDU(fmt, args...)		no_printk(fmt, ##args)
 #define WL_FFPLD(fmt, args...)		no_printk(fmt, ##args)
 
 #define WL_AMPDU_UPDN(fmt, args...)	no_printk(fmt, ##args)
drivers/staging/brcm80211/brcmsmac/wlc_ampdu.c +20 -30

107 lines not on this page · raw message

Signature · 1 line
1.7.1