xref: /freebsd/sys/contrib/dev/broadcom/brcm80211/brcmfmac/tracepoint.c (revision b4c3e9b5b09c829b4135aff738bd2893ed052377)
1*b4c3e9b5SBjoern A. Zeeb // SPDX-License-Identifier: ISC
2*b4c3e9b5SBjoern A. Zeeb /*
3*b4c3e9b5SBjoern A. Zeeb  * Copyright (c) 2012 Broadcom Corporation
4*b4c3e9b5SBjoern A. Zeeb  */
5*b4c3e9b5SBjoern A. Zeeb 
6*b4c3e9b5SBjoern A. Zeeb #include <linux/device.h>
7*b4c3e9b5SBjoern A. Zeeb #include <linux/module.h> /* bug in tracepoint.h, it should include this */
8*b4c3e9b5SBjoern A. Zeeb 
9*b4c3e9b5SBjoern A. Zeeb #ifndef __CHECKER__
10*b4c3e9b5SBjoern A. Zeeb #define CREATE_TRACE_POINTS
11*b4c3e9b5SBjoern A. Zeeb #include "bus.h"
12*b4c3e9b5SBjoern A. Zeeb #include "tracepoint.h"
13*b4c3e9b5SBjoern A. Zeeb #include "debug.h"
14*b4c3e9b5SBjoern A. Zeeb 
__brcmf_err(struct brcmf_bus * bus,const char * func,const char * fmt,...)15*b4c3e9b5SBjoern A. Zeeb void __brcmf_err(struct brcmf_bus *bus, const char *func, const char *fmt, ...)
16*b4c3e9b5SBjoern A. Zeeb {
17*b4c3e9b5SBjoern A. Zeeb 	struct va_format vaf = {
18*b4c3e9b5SBjoern A. Zeeb 		.fmt = fmt,
19*b4c3e9b5SBjoern A. Zeeb 	};
20*b4c3e9b5SBjoern A. Zeeb 	va_list args;
21*b4c3e9b5SBjoern A. Zeeb 
22*b4c3e9b5SBjoern A. Zeeb 	va_start(args, fmt);
23*b4c3e9b5SBjoern A. Zeeb 	vaf.va = &args;
24*b4c3e9b5SBjoern A. Zeeb 	if (bus)
25*b4c3e9b5SBjoern A. Zeeb 		dev_err(bus->dev, "%s: %pV", func, &vaf);
26*b4c3e9b5SBjoern A. Zeeb 	else
27*b4c3e9b5SBjoern A. Zeeb 		pr_err("%s: %pV", func, &vaf);
28*b4c3e9b5SBjoern A. Zeeb 	trace_brcmf_err(func, &vaf);
29*b4c3e9b5SBjoern A. Zeeb 	va_end(args);
30*b4c3e9b5SBjoern A. Zeeb }
31*b4c3e9b5SBjoern A. Zeeb 
32*b4c3e9b5SBjoern A. Zeeb #endif
33