Commit 792aa408 authored by Roland Vossen's avatar Roland Vossen Committed by Greg Kroah-Hartman

staging: brcm80211: replaced WL_TRACE by BCMMSG

Code cleanup. Make code more readable by converting different macro's
(WL_TRACE, WL_AMPDU, etc) into one BCMMSG. This single macro uses wiphy_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.

Cc: devel@linuxdriverproject.org
Cc: linux-wireless@vger.kernel.org
Cc: Brett Rudley <brudley@broadcom.com>
Cc: Henry Ptasinski <henryp@broadcom.com>
Cc: Roland Vossen <rvossen@broadcom.com>
Signed-off-by: default avatarArend van Spriel <arend@broadcom.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 0176a203
......@@ -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) \
wiphy_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_ */
......@@ -766,7 +766,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->wiphy, "force to PCI\n");
}
wl->bcm_bustype = bustype;
......@@ -1104,9 +1104,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);
dev_info(&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) &&
......@@ -1155,8 +1155,6 @@ 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");
hw = pci_get_drvdata(pdev);
wl = HW_TO_WL(hw);
if (!wl) {
......@@ -1182,7 +1180,6 @@ static int wl_resume(struct pci_dev *pdev)
int err = 0;
u32 val;
WL_TRACE("wl: wl_resume\n");
hw = pci_get_drvdata(pdev);
wl = HW_TO_WL(hw);
if (!wl) {
......@@ -1414,8 +1411,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, "wl%d\n", wl->pub->unit);
wl_reset(wl);
wlc_init(wl->wlc);
......@@ -1426,8 +1422,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, "wl%d\n", wl->pub->unit);
wlc_reset(wl->wlc);
/* dpc will not be rescheduled */
......
......@@ -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->wiphy, "wl%d\n", wlc->pub->unit);
wlc_cm = kzalloc(sizeof(wlc_cm_info_t), GFP_ATOMIC);
if (wlc_cm == NULL) {
......
......@@ -331,7 +331,7 @@ void wlc_get_rcmta(struct wlc_info *wlc, int idx, u8 *addr)
d11regs_t *regs = wlc->regs;
u32 v32;
WL_TRACE("wl%d: %s\n", WLCWLUNIT(wlc), __func__);
BCMMSG(wlc->wiphy, "wl%d\n", WLCWLUNIT(wlc));
W_REG(&regs->objaddr, (OBJADDR_RCMTA_SEL | (idx * 2)));
(void)R_REG(&regs->objaddr);
......@@ -385,7 +385,7 @@ bool wlc_ps_allowed(struct wlc_info *wlc)
void wlc_reset(struct wlc_info *wlc)
{
WL_TRACE("wl%d: wlc_reset\n", wlc->pub->unit);
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
wlc->check_for_unaligned_tbtt = false;
......@@ -441,7 +441,7 @@ void wlc_init(struct wlc_info *wlc)
struct wlc_bsscfg *bsscfg;
bool mute = false;
WL_TRACE("wl%d: wlc_init\n", wlc->pub->unit);
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
regs = wlc->regs;
......@@ -613,7 +613,7 @@ void wlc_set_ps_ctrl(struct wlc_info *wlc)
hps = PS_ALLOWED(wlc);
wake = hps ? (STAY_AWAKE(wlc)) : true;
WL_TRACE("wl%d: wlc_set_ps_ctrl: hps %d wake %d\n",
BCMMSG(wlc->wiphy, "wl%d: hps %d wake %d\n",
wlc->pub->unit, hps, wake);
v1 = R_REG(&wlc->regs->maccontrol);
......@@ -1085,7 +1085,7 @@ void wlc_beacon_phytxctl_txant_upd(struct wlc_info *wlc, ratespec_t bcn_rspec)
*/
void wlc_protection_upd(struct wlc_info *wlc, uint idx, int val)
{
WL_TRACE("wlc_protection_upd: idx %d, val %d\n", idx, val);
BCMMSG(wlc->wiphy, "idx %d, val %d\n", idx, val);
switch (idx) {
case WLC_PROT_G_SPEC:
......@@ -1195,7 +1195,7 @@ static void wlc_bandinit_ordered(struct wlc_info *wlc, chanspec_t chanspec)
uint parkband;
uint i, band_order[2];
WL_TRACE("wl%d: wlc_bandinit_ordered\n", wlc->pub->unit);
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
/*
* We might have been bandlocked during down and the chip power-cycled (hibernate).
* figure out the right band to park on
......@@ -1236,7 +1236,7 @@ static void wlc_bandinit_ordered(struct wlc_info *wlc, chanspec_t chanspec)
/* band-specific init */
static void WLBANDINITFN(wlc_bsinit) (struct wlc_info *wlc)
{
WL_TRACE("wl%d: wlc_bsinit: bandunit %d\n",
BCMMSG(wlc->wiphy, "wl%d: bandunit %d\n",
wlc->pub->unit, wlc->band->bandunit);
/* write ucode ACK/CTS rate table */
......@@ -1993,7 +1993,7 @@ uint wlc_detach(struct wlc_info *wlc)
if (wlc == NULL)
return 0;
WL_TRACE("wl%d: %s\n", wlc->pub->unit, __func__);
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
callbacks += wlc_bmac_detach(wlc);
......@@ -2263,7 +2263,7 @@ static void wlc_watchdog(void *arg)
int i;
struct wlc_bsscfg *cfg;
WL_TRACE("wl%d: wlc_watchdog\n", wlc->pub->unit);
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
if (!wlc->pub->up)
return;
......@@ -2331,7 +2331,7 @@ static void wlc_watchdog(void *arg)
/* make interface operational */
int wlc_up(struct wlc_info *wlc)
{
WL_TRACE("wl%d: %s:\n", wlc->pub->unit, __func__);
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
/* HW is turned off so don't try to access it */
if (wlc->pub->hw_off || DEVICEREMOVED(wlc))
......@@ -2477,7 +2477,7 @@ uint wlc_down(struct wlc_info *wlc)
bool dev_gone = false;
struct wlc_txq_info *qi;
WL_TRACE("wl%d: %s:\n", wlc->pub->unit, __func__);
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
/* check if we are already in the going down path */
if (wlc->going_down) {
......@@ -4271,7 +4271,7 @@ wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid,
bool bool_val2;
wlc_bss_info_t *current_bss;
WL_TRACE("wl%d: %s\n", wlc->pub->unit, __func__);
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
bsscfg = NULL;
current_bss = NULL;
......@@ -4295,8 +4295,7 @@ wlc_doiovar(void *hdl, const bcm_iovar_t *vi, u32 actionid,
bool_val = (int_val != 0) ? true : false;
bool_val2 = (int_val2 != 0) ? true : false;
WL_TRACE("wl%d: %s: id %d\n",
wlc->pub->unit, __func__, IOV_ID(actionid));
BCMMSG(wlc->wiphy, "wl%d: id %d\n", wlc->pub->unit, IOV_ID(actionid));
/* Do the actual parameter implementation */
switch (actionid) {
case IOV_SVAL(IOV_RTSTHRESH):
......@@ -5053,7 +5052,7 @@ wlc_txfifo(struct wlc_info *wlc, uint fifo, struct sk_buff *p, bool commit,
*/
if (commit) {
TXPKTPENDINC(wlc, fifo, txpktpend);
WL_TRACE("wlc_txfifo, pktpend inc %d to %d\n",
BCMMSG(wlc->wiphy, "pktpend inc %d to %d\n",
txpktpend, TXPKTPENDGET(wlc, fifo));
}
......@@ -6130,7 +6129,7 @@ void wlc_high_dpc(struct wlc_info *wlc, u32 macintstatus)
if (macintstatus & ~(MI_TBTT | MI_TXSTOP)) {
bcm_format_flags(int_flags, macintstatus, flagstr,
sizeof(flagstr));
WL_TRACE("wl%d: macintstatus 0x%x %s\n",
BCMMSG(wlc->wiphy, "wl%d: macintstatus 0x%x %s\n",
wlc->pub->unit, macintstatus, flagstr);
}
#endif /* BCMDBG */
......@@ -6362,8 +6361,8 @@ void BCMFASTPATH
wlc_txfifo_complete(struct wlc_info *wlc, uint fifo, s8 txpktpend)
{
TXPKTPENDDEC(wlc, fifo, txpktpend);
WL_TRACE("wlc_txfifo_complete, pktpend dec %d to %d\n",
txpktpend, TXPKTPENDGET(wlc, fifo));
BCMMSG(wlc->wiphy, "pktpend dec %d to %d\n", txpktpend,
TXPKTPENDGET(wlc, fifo));
/* There is more room; mark precedences related to this FIFO sendable */
WLC_TX_FIFO_ENAB(wlc, fifo);
......@@ -6673,7 +6672,7 @@ void BCMFASTPATH wlc_recv(struct wlc_info *wlc, struct sk_buff *p)
uint len;
bool is_amsdu;
WL_TRACE("wl%d: wlc_recv\n", wlc->pub->unit);
BCMMSG(wlc->wiphy, "wl%d\n", wlc->pub->unit);
/* frame starts with rxhdr */
rxh = (d11rxhdr_t *) (p->data);
......@@ -6771,7 +6770,7 @@ wlc_calc_lsig_len(struct wlc_info *wlc, ratespec_t ratespec, uint mac_len)
{
uint nsyms, len = 0, kNdps;
WL_TRACE("wl%d: wlc_calc_lsig_len: rate %d, len%d\n",
BCMMSG(wlc->wiphy, "wl%d: rate %d, len%d\n",
wlc->pub->unit, RSPEC2RATE(ratespec), mac_len);
if (IS_MCS(ratespec)) {
......@@ -6819,7 +6818,7 @@ wlc_calc_frame_time(struct wlc_info *wlc, ratespec_t ratespec, u8 preamble_type,
rate = WLC_RATE_1M;
}
WL_TRACE("wl%d: wlc_calc_frame_time: rspec 0x%x, preamble_type %d, len%d\n",
BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, preamble_type %d, len%d\n",
wlc->pub->unit, ratespec, preamble_type, mac_len);
if (IS_MCS(ratespec)) {
......@@ -6882,7 +6881,7 @@ wlc_calc_frame_len(struct wlc_info *wlc, ratespec_t ratespec, u8 preamble_type,
uint nsyms, mac_len, Ndps, kNdps;
uint rate = RSPEC2RATE(ratespec);
WL_TRACE("wl%d: wlc_calc_frame_len: rspec 0x%x, preamble_type %d, dur %d\n",
BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, preamble_type %d, dur %d\n",
wlc->pub->unit, ratespec, preamble_type, dur);
if (IS_MCS(ratespec)) {
......@@ -6924,8 +6923,8 @@ wlc_calc_frame_len(struct wlc_info *wlc, ratespec_t ratespec, u8 preamble_type,
static uint
wlc_calc_ba_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type)
{
WL_TRACE("wl%d: wlc_calc_ba_time: rspec 0x%x, preamble_type %d\n",
wlc->pub->unit, rspec, preamble_type);
BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, "
"preamble_type %d\n", wlc->pub->unit, rspec, preamble_type);
/* Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that is less than
* or equal to the rate of the immediately previous frame in the FES
*/
......@@ -6941,8 +6940,8 @@ wlc_calc_ack_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type)
{
uint dur = 0;
WL_TRACE("wl%d: wlc_calc_ack_time: rspec 0x%x, preamble_type %d\n",
wlc->pub->unit, rspec, preamble_type);
BCMMSG(wlc->wiphy, "wl%d: rspec 0x%x, preamble_type %d\n",
wlc->pub->unit, rspec, preamble_type);
/* Spec 9.6: ack rate is the highest rate in BSSBasicRateSet that is less than
* or equal to the rate of the immediately previous frame in the FES
*/
......@@ -6957,8 +6956,8 @@ wlc_calc_ack_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type)
static uint
wlc_calc_cts_time(struct wlc_info *wlc, ratespec_t rspec, u8 preamble_type)
{
WL_TRACE("wl%d: wlc_calc_cts_time: ratespec 0x%x, preamble_type %d\n",
wlc->pub->unit, rspec, preamble_type);
BCMMSG(wlc->wiphy, "wl%d: ratespec 0x%x, preamble_type %d\n",
wlc->pub->unit, rspec, preamble_type);
return wlc_calc_ack_time(wlc, rspec, preamble_type);
}
......@@ -7659,8 +7658,9 @@ mac80211_wlc_set_nrate(struct wlc_info *wlc, struct wlcband *cur_band,
} else if (rate > HIGHEST_SINGLE_STREAM_MCS) {
/* mcs > 7 must use stf SDM */
if (stf != PHY_TXC1_MODE_SDM) {
WL_TRACE("wl%d: %s: enabling SDM mode for mcs %d\n",
WLCWLUNIT(wlc), __func__, rate);
BCMMSG(wlc->wiphy, "wl%d: enabling "
"SDM mode for mcs %d\n",
WLCWLUNIT(wlc), rate);
stf = PHY_TXC1_MODE_SDM;
}
} else {
......@@ -7931,7 +7931,7 @@ void wlc_txflowcontrol(struct wlc_info *wlc, struct wlc_txq_info *qi,
uint prio_bits;
uint cur_bits;
WL_TRACE("%s: flow control kicks in\n", __func__);
BCMMSG(wlc->wiphy, "flow control kicks in\n");
if (prio == ALLPRIO) {
prio_bits = TXQ_STOP_FOR_PRIOFC_MASK;
......
......@@ -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->wiphy, "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->wiphy, "wl%d: val %x\n", wlc->pub->unit, val);
wlc->stf->spatial_policy = (s8) val;
for (i = 1; i <= MAX_STREAMS_SUPPORTED; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment