1 /*
2  * Copyright (c) 2011 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 
17 #if !defined(__TRACE_BRCMSMAC_MSG_H) || defined(TRACE_HEADER_MULTI_READ)
18 #define __TRACE_BRCMSMAC_MSG_H
19 
20 #include <linux/tracepoint.h>
21 
22 #undef TRACE_SYSTEM
23 #define TRACE_SYSTEM brcmsmac_msg
24 
25 #define MAX_MSG_LEN	100
26 
27 #pragma GCC diagnostic push
28 #ifndef __clang__
29 #pragma GCC diagnostic ignored "-Wsuggest-attribute=format"
30 #endif
31 
32 DECLARE_EVENT_CLASS(brcms_msg_event,
33 	TP_PROTO(struct va_format *vaf),
34 	TP_ARGS(vaf),
35 	TP_STRUCT__entry(
36 		__vstring(msg, vaf->fmt, vaf->va)
37 	),
38 	TP_fast_assign(
39 		__assign_vstr(msg, vaf->fmt, vaf->va);
40 	),
41 	TP_printk("%s", __get_str(msg))
42 );
43 
44 DEFINE_EVENT(brcms_msg_event, brcms_info,
45 	TP_PROTO(struct va_format *vaf),
46 	TP_ARGS(vaf)
47 );
48 
49 DEFINE_EVENT(brcms_msg_event, brcms_warn,
50 	TP_PROTO(struct va_format *vaf),
51 	TP_ARGS(vaf)
52 );
53 
54 DEFINE_EVENT(brcms_msg_event, brcms_err,
55 	TP_PROTO(struct va_format *vaf),
56 	TP_ARGS(vaf)
57 );
58 
59 DEFINE_EVENT(brcms_msg_event, brcms_crit,
60 	TP_PROTO(struct va_format *vaf),
61 	TP_ARGS(vaf)
62 );
63 
64 TRACE_EVENT(brcms_dbg,
65 	TP_PROTO(u32 level, const char *func, struct va_format *vaf),
66 	TP_ARGS(level, func, vaf),
67 	TP_STRUCT__entry(
68 		__field(u32, level)
69 		__string(func, func)
70 		__vstring(msg, vaf->fmt, vaf->va)
71 	),
72 	TP_fast_assign(
73 		__entry->level = level;
74 		__assign_str(func, func);
75 		__assign_vstr(msg, vaf->fmt, vaf->va);
76 	),
77 	TP_printk("%s: %s", __get_str(func), __get_str(msg))
78 );
79 
80 #pragma GCC diagnostic pop
81 
82 #endif /* __TRACE_BRCMSMAC_MSG_H */
83 
84 #ifdef CONFIG_BRCM_TRACING
85 
86 #undef TRACE_INCLUDE_PATH
87 #define TRACE_INCLUDE_PATH .
88 #undef TRACE_INCLUDE_FILE
89 #define TRACE_INCLUDE_FILE brcms_trace_brcmsmac_msg
90 #include <trace/define_trace.h>
91 
92 #endif /* CONFIG_BRCM_TRACING */
93