diff options
Diffstat (limited to 'drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h')
-rw-r--r-- | drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h b/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h new file mode 100644 index 000000000000..9df1f7a681e0 --- /dev/null +++ b/drivers/net/wireless/brcm80211/brcmfmac/tracepoint.h | |||
@@ -0,0 +1,101 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2013 Broadcom Corporation | ||
3 | * | ||
4 | * Permission to use, copy, modify, and/or distribute this software for any | ||
5 | * purpose with or without fee is hereby granted, provided that the above | ||
6 | * copyright notice and this permission notice appear in all copies. | ||
7 | * | ||
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | ||
11 | * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION | ||
13 | * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN | ||
14 | * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
15 | */ | ||
16 | #if !defined(BRCMF_TRACEPOINT_H_) || defined(TRACE_HEADER_MULTI_READ) | ||
17 | #define BRCMF_TRACEPOINT_H_ | ||
18 | |||
19 | #include <linux/types.h> | ||
20 | #include <linux/tracepoint.h> | ||
21 | |||
22 | #ifndef CONFIG_BRCM_TRACING | ||
23 | |||
24 | #undef TRACE_EVENT | ||
25 | #define TRACE_EVENT(name, proto, ...) \ | ||
26 | static inline void trace_ ## name(proto) {} | ||
27 | |||
28 | #undef DECLARE_EVENT_CLASS | ||
29 | #define DECLARE_EVENT_CLASS(...) | ||
30 | |||
31 | #undef DEFINE_EVENT | ||
32 | #define DEFINE_EVENT(evt_class, name, proto, ...) \ | ||
33 | static inline void trace_ ## name(proto) {} | ||
34 | |||
35 | #endif /* CONFIG_BRCM_TRACING */ | ||
36 | |||
37 | #undef TRACE_SYSTEM | ||
38 | #define TRACE_SYSTEM brcmfmac | ||
39 | |||
40 | #define MAX_MSG_LEN 100 | ||
41 | |||
42 | TRACE_EVENT(brcmf_err, | ||
43 | TP_PROTO(const char *func, struct va_format *vaf), | ||
44 | TP_ARGS(func, vaf), | ||
45 | TP_STRUCT__entry( | ||
46 | __string(func, func) | ||
47 | __dynamic_array(char, msg, MAX_MSG_LEN) | ||
48 | ), | ||
49 | TP_fast_assign( | ||
50 | __assign_str(func, func); | ||
51 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), | ||
52 | MAX_MSG_LEN, vaf->fmt, | ||
53 | *vaf->va) >= MAX_MSG_LEN); | ||
54 | ), | ||
55 | TP_printk("%s: %s", __get_str(func), __get_str(msg)) | ||
56 | ); | ||
57 | |||
58 | TRACE_EVENT(brcmf_dbg, | ||
59 | TP_PROTO(u32 level, const char *func, struct va_format *vaf), | ||
60 | TP_ARGS(level, func, vaf), | ||
61 | TP_STRUCT__entry( | ||
62 | __field(u32, level) | ||
63 | __string(func, func) | ||
64 | __dynamic_array(char, msg, MAX_MSG_LEN) | ||
65 | ), | ||
66 | TP_fast_assign( | ||
67 | __entry->level = level; | ||
68 | __assign_str(func, func); | ||
69 | WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg), | ||
70 | MAX_MSG_LEN, vaf->fmt, | ||
71 | *vaf->va) >= MAX_MSG_LEN); | ||
72 | ), | ||
73 | TP_printk("%s: %s", __get_str(func), __get_str(msg)) | ||
74 | ); | ||
75 | |||
76 | TRACE_EVENT(brcmf_hexdump, | ||
77 | TP_PROTO(void *data, size_t len), | ||
78 | TP_ARGS(data, len), | ||
79 | TP_STRUCT__entry( | ||
80 | __field(unsigned long, len) | ||
81 | __dynamic_array(u8, hdata, len) | ||
82 | ), | ||
83 | TP_fast_assign( | ||
84 | __entry->len = len; | ||
85 | memcpy(__get_dynamic_array(hdata), data, len); | ||
86 | ), | ||
87 | TP_printk("hexdump [length=%lu]", __entry->len) | ||
88 | ); | ||
89 | |||
90 | #ifdef CONFIG_BRCM_TRACING | ||
91 | |||
92 | #undef TRACE_INCLUDE_PATH | ||
93 | #define TRACE_INCLUDE_PATH . | ||
94 | #undef TRACE_INCLUDE_FILE | ||
95 | #define TRACE_INCLUDE_FILE tracepoint | ||
96 | |||
97 | #include <trace/define_trace.h> | ||
98 | |||
99 | #endif /* CONFIG_BRCM_TRACING */ | ||
100 | |||
101 | #endif /* BRCMF_TRACEPOINT_H_ */ | ||