xref: /freebsd/sys/contrib/dev/broadcom/brcm80211/brcmsmac/debug.c (revision b4c3e9b5b09c829b4135aff738bd2893ed052377)
1*b4c3e9b5SBjoern A. Zeeb /*
2*b4c3e9b5SBjoern A. Zeeb  * Copyright (c) 2012 Broadcom Corporation
3*b4c3e9b5SBjoern A. Zeeb  * Copyright (c) 2012 Canonical Ltd.
4*b4c3e9b5SBjoern A. Zeeb  *
5*b4c3e9b5SBjoern A. Zeeb  * Permission to use, copy, modify, and/or distribute this software for any
6*b4c3e9b5SBjoern A. Zeeb  * purpose with or without fee is hereby granted, provided that the above
7*b4c3e9b5SBjoern A. Zeeb  * copyright notice and this permission notice appear in all copies.
8*b4c3e9b5SBjoern A. Zeeb  *
9*b4c3e9b5SBjoern A. Zeeb  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10*b4c3e9b5SBjoern A. Zeeb  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11*b4c3e9b5SBjoern A. Zeeb  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
12*b4c3e9b5SBjoern A. Zeeb  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13*b4c3e9b5SBjoern A. Zeeb  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
14*b4c3e9b5SBjoern A. Zeeb  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
15*b4c3e9b5SBjoern A. Zeeb  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16*b4c3e9b5SBjoern A. Zeeb  */
17*b4c3e9b5SBjoern A. Zeeb #include <linux/debugfs.h>
18*b4c3e9b5SBjoern A. Zeeb #include <linux/if_ether.h>
19*b4c3e9b5SBjoern A. Zeeb #include <linux/if.h>
20*b4c3e9b5SBjoern A. Zeeb #include <linux/net.h>
21*b4c3e9b5SBjoern A. Zeeb #include <linux/netdevice.h>
22*b4c3e9b5SBjoern A. Zeeb #include <linux/ieee80211.h>
23*b4c3e9b5SBjoern A. Zeeb #include <linux/module.h>
24*b4c3e9b5SBjoern A. Zeeb #include <net/mac80211.h>
25*b4c3e9b5SBjoern A. Zeeb 
26*b4c3e9b5SBjoern A. Zeeb #include <defs.h>
27*b4c3e9b5SBjoern A. Zeeb #include <brcmu_wifi.h>
28*b4c3e9b5SBjoern A. Zeeb #include <brcmu_utils.h>
29*b4c3e9b5SBjoern A. Zeeb #include "types.h"
30*b4c3e9b5SBjoern A. Zeeb #include "main.h"
31*b4c3e9b5SBjoern A. Zeeb #include "debug.h"
32*b4c3e9b5SBjoern A. Zeeb #include "brcms_trace_events.h"
33*b4c3e9b5SBjoern A. Zeeb #include "phy/phy_int.h"
34*b4c3e9b5SBjoern A. Zeeb 
35*b4c3e9b5SBjoern A. Zeeb static struct dentry *root_folder;
36*b4c3e9b5SBjoern A. Zeeb 
brcms_debugfs_init(void)37*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_init(void)
38*b4c3e9b5SBjoern A. Zeeb {
39*b4c3e9b5SBjoern A. Zeeb 	root_folder = debugfs_create_dir(KBUILD_MODNAME, NULL);
40*b4c3e9b5SBjoern A. Zeeb }
41*b4c3e9b5SBjoern A. Zeeb 
brcms_debugfs_exit(void)42*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_exit(void)
43*b4c3e9b5SBjoern A. Zeeb {
44*b4c3e9b5SBjoern A. Zeeb 	debugfs_remove_recursive(root_folder);
45*b4c3e9b5SBjoern A. Zeeb 	root_folder = NULL;
46*b4c3e9b5SBjoern A. Zeeb }
47*b4c3e9b5SBjoern A. Zeeb 
brcms_debugfs_attach(struct brcms_pub * drvr)48*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_attach(struct brcms_pub *drvr)
49*b4c3e9b5SBjoern A. Zeeb {
50*b4c3e9b5SBjoern A. Zeeb 	drvr->dbgfs_dir = debugfs_create_dir(
51*b4c3e9b5SBjoern A. Zeeb 		 dev_name(&drvr->wlc->hw->d11core->dev), root_folder);
52*b4c3e9b5SBjoern A. Zeeb }
53*b4c3e9b5SBjoern A. Zeeb 
brcms_debugfs_detach(struct brcms_pub * drvr)54*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_detach(struct brcms_pub *drvr)
55*b4c3e9b5SBjoern A. Zeeb {
56*b4c3e9b5SBjoern A. Zeeb 	debugfs_remove_recursive(drvr->dbgfs_dir);
57*b4c3e9b5SBjoern A. Zeeb }
58*b4c3e9b5SBjoern A. Zeeb 
59*b4c3e9b5SBjoern A. Zeeb static
brcms_debugfs_hardware_read(struct seq_file * s,void * data)60*b4c3e9b5SBjoern A. Zeeb int brcms_debugfs_hardware_read(struct seq_file *s, void *data)
61*b4c3e9b5SBjoern A. Zeeb {
62*b4c3e9b5SBjoern A. Zeeb 	struct brcms_pub *drvr = s->private;
63*b4c3e9b5SBjoern A. Zeeb 	struct brcms_hardware *hw = drvr->wlc->hw;
64*b4c3e9b5SBjoern A. Zeeb 	struct bcma_device *core = hw->d11core;
65*b4c3e9b5SBjoern A. Zeeb 	struct bcma_bus *bus = core->bus;
66*b4c3e9b5SBjoern A. Zeeb 	char boardrev[BRCMU_BOARDREV_LEN];
67*b4c3e9b5SBjoern A. Zeeb 
68*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "chipnum 0x%x\n"
69*b4c3e9b5SBjoern A. Zeeb 		   "chiprev 0x%x\n"
70*b4c3e9b5SBjoern A. Zeeb 		   "chippackage 0x%x\n"
71*b4c3e9b5SBjoern A. Zeeb 		   "corerev 0x%x\n"
72*b4c3e9b5SBjoern A. Zeeb 		   "boardid 0x%x\n"
73*b4c3e9b5SBjoern A. Zeeb 		   "boardvendor 0x%x\n"
74*b4c3e9b5SBjoern A. Zeeb 		   "boardrev %s\n"
75*b4c3e9b5SBjoern A. Zeeb 		   "boardflags 0x%x\n"
76*b4c3e9b5SBjoern A. Zeeb 		   "boardflags2 0x%x\n"
77*b4c3e9b5SBjoern A. Zeeb 		   "ucoderev 0x%x\n"
78*b4c3e9b5SBjoern A. Zeeb 		   "radiorev 0x%x\n"
79*b4c3e9b5SBjoern A. Zeeb 		   "phytype 0x%x\n"
80*b4c3e9b5SBjoern A. Zeeb 		   "phyrev 0x%x\n"
81*b4c3e9b5SBjoern A. Zeeb 		   "anarev 0x%x\n"
82*b4c3e9b5SBjoern A. Zeeb 		   "nvramrev %d\n",
83*b4c3e9b5SBjoern A. Zeeb 		   bus->chipinfo.id, bus->chipinfo.rev, bus->chipinfo.pkg,
84*b4c3e9b5SBjoern A. Zeeb 		   core->id.rev, bus->boardinfo.type, bus->boardinfo.vendor,
85*b4c3e9b5SBjoern A. Zeeb 		   brcmu_boardrev_str(hw->boardrev, boardrev),
86*b4c3e9b5SBjoern A. Zeeb 		   drvr->wlc->hw->boardflags, drvr->wlc->hw->boardflags2,
87*b4c3e9b5SBjoern A. Zeeb 		   drvr->wlc->ucode_rev, hw->band->radiorev,
88*b4c3e9b5SBjoern A. Zeeb 		   hw->band->phytype, hw->band->phyrev, hw->band->pi->ana_rev,
89*b4c3e9b5SBjoern A. Zeeb 		   hw->sromrev);
90*b4c3e9b5SBjoern A. Zeeb 	return 0;
91*b4c3e9b5SBjoern A. Zeeb }
92*b4c3e9b5SBjoern A. Zeeb 
brcms_debugfs_macstat_read(struct seq_file * s,void * data)93*b4c3e9b5SBjoern A. Zeeb static int brcms_debugfs_macstat_read(struct seq_file *s, void *data)
94*b4c3e9b5SBjoern A. Zeeb {
95*b4c3e9b5SBjoern A. Zeeb 	struct brcms_pub *drvr = s->private;
96*b4c3e9b5SBjoern A. Zeeb 	struct brcms_info *wl = drvr->ieee_hw->priv;
97*b4c3e9b5SBjoern A. Zeeb 	struct macstat stats;
98*b4c3e9b5SBjoern A. Zeeb 	int i;
99*b4c3e9b5SBjoern A. Zeeb 
100*b4c3e9b5SBjoern A. Zeeb 	spin_lock_bh(&wl->lock);
101*b4c3e9b5SBjoern A. Zeeb 	stats = *(drvr->wlc->core->macstat_snapshot);
102*b4c3e9b5SBjoern A. Zeeb 	spin_unlock_bh(&wl->lock);
103*b4c3e9b5SBjoern A. Zeeb 
104*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txallfrm: %d\n", stats.txallfrm);
105*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txrtsfrm: %d\n", stats.txrtsfrm);
106*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txctsfrm: %d\n", stats.txctsfrm);
107*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txackfrm: %d\n", stats.txackfrm);
108*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txdnlfrm: %d\n", stats.txdnlfrm);
109*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txbcnfrm: %d\n", stats.txbcnfrm);
110*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txfunfl[8]:");
111*b4c3e9b5SBjoern A. Zeeb 	for (i = 0; i < ARRAY_SIZE(stats.txfunfl); i++)
112*b4c3e9b5SBjoern A. Zeeb 		seq_printf(s, " %d", stats.txfunfl[i]);
113*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "\ntxtplunfl: %d\n", stats.txtplunfl);
114*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txphyerr: %d\n", stats.txphyerr);
115*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "pktengrxducast: %d\n", stats.pktengrxducast);
116*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "pktengrxdmcast: %d\n", stats.pktengrxdmcast);
117*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxfrmtoolong: %d\n", stats.rxfrmtoolong);
118*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxfrmtooshrt: %d\n", stats.rxfrmtooshrt);
119*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxinvmachdr: %d\n", stats.rxinvmachdr);
120*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxbadfcs: %d\n", stats.rxbadfcs);
121*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxbadplcp: %d\n", stats.rxbadplcp);
122*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxcrsglitch: %d\n", stats.rxcrsglitch);
123*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxstrt: %d\n", stats.rxstrt);
124*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxdfrmucastmbss: %d\n", stats.rxdfrmucastmbss);
125*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxmfrmucastmbss: %d\n", stats.rxmfrmucastmbss);
126*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxcfrmucast: %d\n", stats.rxcfrmucast);
127*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxrtsucast: %d\n", stats.rxrtsucast);
128*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxctsucast: %d\n", stats.rxctsucast);
129*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxackucast: %d\n", stats.rxackucast);
130*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxdfrmocast: %d\n", stats.rxdfrmocast);
131*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxmfrmocast: %d\n", stats.rxmfrmocast);
132*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxcfrmocast: %d\n", stats.rxcfrmocast);
133*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxrtsocast: %d\n", stats.rxrtsocast);
134*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxctsocast: %d\n", stats.rxctsocast);
135*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxdfrmmcast: %d\n", stats.rxdfrmmcast);
136*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxmfrmmcast: %d\n", stats.rxmfrmmcast);
137*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxcfrmmcast: %d\n", stats.rxcfrmmcast);
138*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxbeaconmbss: %d\n", stats.rxbeaconmbss);
139*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxdfrmucastobss: %d\n", stats.rxdfrmucastobss);
140*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxbeaconobss: %d\n", stats.rxbeaconobss);
141*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxrsptmout: %d\n", stats.rxrsptmout);
142*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "bcntxcancl: %d\n", stats.bcntxcancl);
143*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxf0ovfl: %d\n", stats.rxf0ovfl);
144*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxf1ovfl: %d\n", stats.rxf1ovfl);
145*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxf2ovfl: %d\n", stats.rxf2ovfl);
146*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txsfovfl: %d\n", stats.txsfovfl);
147*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "pmqovfl: %d\n", stats.pmqovfl);
148*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxcgprqfrm: %d\n", stats.rxcgprqfrm);
149*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxcgprsqovfl: %d\n", stats.rxcgprsqovfl);
150*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txcgprsfail: %d\n", stats.txcgprsfail);
151*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txcgprssuc: %d\n", stats.txcgprssuc);
152*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "prs_timeout: %d\n", stats.prs_timeout);
153*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "rxnack: %d\n", stats.rxnack);
154*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "frmscons: %d\n", stats.frmscons);
155*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txnack: %d\n", stats.txnack);
156*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txglitch_nack: %d\n", stats.txglitch_nack);
157*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "txburst: %d\n", stats.txburst);
158*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "bphy_rxcrsglitch: %d\n", stats.bphy_rxcrsglitch);
159*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "phywatchdog: %d\n", stats.phywatchdog);
160*b4c3e9b5SBjoern A. Zeeb 	seq_printf(s, "bphy_badplcp: %d\n", stats.bphy_badplcp);
161*b4c3e9b5SBjoern A. Zeeb 	return 0;
162*b4c3e9b5SBjoern A. Zeeb }
163*b4c3e9b5SBjoern A. Zeeb 
164*b4c3e9b5SBjoern A. Zeeb struct brcms_debugfs_entry {
165*b4c3e9b5SBjoern A. Zeeb 	int (*read)(struct seq_file *seq, void *data);
166*b4c3e9b5SBjoern A. Zeeb 	struct brcms_pub *drvr;
167*b4c3e9b5SBjoern A. Zeeb };
168*b4c3e9b5SBjoern A. Zeeb 
brcms_debugfs_entry_open(struct inode * inode,struct file * f)169*b4c3e9b5SBjoern A. Zeeb static int brcms_debugfs_entry_open(struct inode *inode, struct file *f)
170*b4c3e9b5SBjoern A. Zeeb {
171*b4c3e9b5SBjoern A. Zeeb 	struct brcms_debugfs_entry *entry = inode->i_private;
172*b4c3e9b5SBjoern A. Zeeb 
173*b4c3e9b5SBjoern A. Zeeb 	return single_open(f, entry->read, entry->drvr);
174*b4c3e9b5SBjoern A. Zeeb }
175*b4c3e9b5SBjoern A. Zeeb 
176*b4c3e9b5SBjoern A. Zeeb static const struct file_operations brcms_debugfs_def_ops = {
177*b4c3e9b5SBjoern A. Zeeb 	.owner = THIS_MODULE,
178*b4c3e9b5SBjoern A. Zeeb 	.open = brcms_debugfs_entry_open,
179*b4c3e9b5SBjoern A. Zeeb 	.release = single_release,
180*b4c3e9b5SBjoern A. Zeeb 	.read = seq_read,
181*b4c3e9b5SBjoern A. Zeeb 	.llseek = seq_lseek
182*b4c3e9b5SBjoern A. Zeeb };
183*b4c3e9b5SBjoern A. Zeeb 
184*b4c3e9b5SBjoern A. Zeeb static void
brcms_debugfs_add_entry(struct brcms_pub * drvr,const char * fn,int (* read_fn)(struct seq_file * seq,void * data))185*b4c3e9b5SBjoern A. Zeeb brcms_debugfs_add_entry(struct brcms_pub *drvr, const char *fn,
186*b4c3e9b5SBjoern A. Zeeb 			int (*read_fn)(struct seq_file *seq, void *data))
187*b4c3e9b5SBjoern A. Zeeb {
188*b4c3e9b5SBjoern A. Zeeb 	struct device *dev = &drvr->wlc->hw->d11core->dev;
189*b4c3e9b5SBjoern A. Zeeb 	struct dentry *dentry =  drvr->dbgfs_dir;
190*b4c3e9b5SBjoern A. Zeeb 	struct brcms_debugfs_entry *entry;
191*b4c3e9b5SBjoern A. Zeeb 
192*b4c3e9b5SBjoern A. Zeeb 	entry = devm_kzalloc(dev, sizeof(*entry), GFP_KERNEL);
193*b4c3e9b5SBjoern A. Zeeb 	if (!entry)
194*b4c3e9b5SBjoern A. Zeeb 		return;
195*b4c3e9b5SBjoern A. Zeeb 
196*b4c3e9b5SBjoern A. Zeeb 	entry->read = read_fn;
197*b4c3e9b5SBjoern A. Zeeb 	entry->drvr = drvr;
198*b4c3e9b5SBjoern A. Zeeb 
199*b4c3e9b5SBjoern A. Zeeb 	debugfs_create_file(fn, 0444, dentry, entry, &brcms_debugfs_def_ops);
200*b4c3e9b5SBjoern A. Zeeb }
201*b4c3e9b5SBjoern A. Zeeb 
brcms_debugfs_create_files(struct brcms_pub * drvr)202*b4c3e9b5SBjoern A. Zeeb void brcms_debugfs_create_files(struct brcms_pub *drvr)
203*b4c3e9b5SBjoern A. Zeeb {
204*b4c3e9b5SBjoern A. Zeeb 	brcms_debugfs_add_entry(drvr, "hardware", brcms_debugfs_hardware_read);
205*b4c3e9b5SBjoern A. Zeeb 	brcms_debugfs_add_entry(drvr, "macstat", brcms_debugfs_macstat_read);
206*b4c3e9b5SBjoern A. Zeeb }
207*b4c3e9b5SBjoern A. Zeeb 
208*b4c3e9b5SBjoern A. Zeeb #define __brcms_fn(fn)						\
209*b4c3e9b5SBjoern A. Zeeb void __brcms_ ##fn(struct device *dev, const char *fmt, ...)	\
210*b4c3e9b5SBjoern A. Zeeb {								\
211*b4c3e9b5SBjoern A. Zeeb 	struct va_format vaf = {				\
212*b4c3e9b5SBjoern A. Zeeb 		.fmt = fmt,					\
213*b4c3e9b5SBjoern A. Zeeb 	};							\
214*b4c3e9b5SBjoern A. Zeeb 	va_list args;						\
215*b4c3e9b5SBjoern A. Zeeb 								\
216*b4c3e9b5SBjoern A. Zeeb 	va_start(args, fmt);					\
217*b4c3e9b5SBjoern A. Zeeb 	vaf.va = &args;						\
218*b4c3e9b5SBjoern A. Zeeb 	dev_ ##fn(dev, "%pV", &vaf);				\
219*b4c3e9b5SBjoern A. Zeeb 	trace_brcms_ ##fn(&vaf);				\
220*b4c3e9b5SBjoern A. Zeeb 	va_end(args);						\
221*b4c3e9b5SBjoern A. Zeeb }
222*b4c3e9b5SBjoern A. Zeeb 
223*b4c3e9b5SBjoern A. Zeeb __brcms_fn(info)
__brcms_fn(warn)224*b4c3e9b5SBjoern A. Zeeb __brcms_fn(warn)
225*b4c3e9b5SBjoern A. Zeeb __brcms_fn(err)
226*b4c3e9b5SBjoern A. Zeeb __brcms_fn(crit)
227*b4c3e9b5SBjoern A. Zeeb 
228*b4c3e9b5SBjoern A. Zeeb #if defined(CONFIG_BRCMDBG) || defined(CONFIG_BRCM_TRACING)
229*b4c3e9b5SBjoern A. Zeeb void __brcms_dbg(struct device *dev, u32 level, const char *func,
230*b4c3e9b5SBjoern A. Zeeb 		 const char *fmt, ...)
231*b4c3e9b5SBjoern A. Zeeb {
232*b4c3e9b5SBjoern A. Zeeb 	struct va_format vaf = {
233*b4c3e9b5SBjoern A. Zeeb 		.fmt = fmt,
234*b4c3e9b5SBjoern A. Zeeb 	};
235*b4c3e9b5SBjoern A. Zeeb 	va_list args;
236*b4c3e9b5SBjoern A. Zeeb 
237*b4c3e9b5SBjoern A. Zeeb 	va_start(args, fmt);
238*b4c3e9b5SBjoern A. Zeeb 	vaf.va = &args;
239*b4c3e9b5SBjoern A. Zeeb #ifdef CONFIG_BRCMDBG
240*b4c3e9b5SBjoern A. Zeeb 	if ((brcm_msg_level & level) && net_ratelimit())
241*b4c3e9b5SBjoern A. Zeeb 		dev_err(dev, "%s %pV", func, &vaf);
242*b4c3e9b5SBjoern A. Zeeb #endif
243*b4c3e9b5SBjoern A. Zeeb 	trace_brcms_dbg(level, func, &vaf);
244*b4c3e9b5SBjoern A. Zeeb 	va_end(args);
245*b4c3e9b5SBjoern A. Zeeb }
246*b4c3e9b5SBjoern A. Zeeb #endif
247