fix a kmap leak in virtio_console
[linux/fpc-iii.git] / drivers / net / wireless / ath / ath10k / trace.h
blob4eb2ecbc06ef21d95339abf48dd990203dab7f8b
1 /*
2 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2013 Qualcomm Atheros, Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 #if !defined(_TRACE_H_) || defined(TRACE_HEADER_MULTI_READ)
20 #include <linux/tracepoint.h>
22 #define _TRACE_H_
24 /* create empty functions when tracing is disabled */
25 #if !defined(CONFIG_ATH10K_TRACING)
26 #undef TRACE_EVENT
27 #define TRACE_EVENT(name, proto, ...) \
28 static inline void trace_ ## name(proto) {}
29 #undef DECLARE_EVENT_CLASS
30 #define DECLARE_EVENT_CLASS(...)
31 #undef DEFINE_EVENT
32 #define DEFINE_EVENT(evt_class, name, proto, ...) \
33 static inline void trace_ ## name(proto) {}
34 #endif /* !CONFIG_ATH10K_TRACING || __CHECKER__ */
36 #undef TRACE_SYSTEM
37 #define TRACE_SYSTEM ath10k
39 #define ATH10K_MSG_MAX 200
41 DECLARE_EVENT_CLASS(ath10k_log_event,
42 TP_PROTO(struct va_format *vaf),
43 TP_ARGS(vaf),
44 TP_STRUCT__entry(
45 __dynamic_array(char, msg, ATH10K_MSG_MAX)
47 TP_fast_assign(
48 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
49 ATH10K_MSG_MAX,
50 vaf->fmt,
51 *vaf->va) >= ATH10K_MSG_MAX);
53 TP_printk("%s", __get_str(msg))
56 DEFINE_EVENT(ath10k_log_event, ath10k_log_err,
57 TP_PROTO(struct va_format *vaf),
58 TP_ARGS(vaf)
61 DEFINE_EVENT(ath10k_log_event, ath10k_log_warn,
62 TP_PROTO(struct va_format *vaf),
63 TP_ARGS(vaf)
66 DEFINE_EVENT(ath10k_log_event, ath10k_log_info,
67 TP_PROTO(struct va_format *vaf),
68 TP_ARGS(vaf)
71 TRACE_EVENT(ath10k_log_dbg,
72 TP_PROTO(unsigned int level, struct va_format *vaf),
73 TP_ARGS(level, vaf),
74 TP_STRUCT__entry(
75 __field(unsigned int, level)
76 __dynamic_array(char, msg, ATH10K_MSG_MAX)
78 TP_fast_assign(
79 __entry->level = level;
80 WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
81 ATH10K_MSG_MAX,
82 vaf->fmt,
83 *vaf->va) >= ATH10K_MSG_MAX);
85 TP_printk("%s", __get_str(msg))
88 TRACE_EVENT(ath10k_log_dbg_dump,
89 TP_PROTO(const char *msg, const char *prefix,
90 const void *buf, size_t buf_len),
92 TP_ARGS(msg, prefix, buf, buf_len),
94 TP_STRUCT__entry(
95 __string(msg, msg)
96 __string(prefix, prefix)
97 __field(size_t, buf_len)
98 __dynamic_array(u8, buf, buf_len)
101 TP_fast_assign(
102 __assign_str(msg, msg);
103 __assign_str(prefix, prefix);
104 __entry->buf_len = buf_len;
105 memcpy(__get_dynamic_array(buf), buf, buf_len);
108 TP_printk(
109 "%s/%s\n", __get_str(prefix), __get_str(msg)
113 TRACE_EVENT(ath10k_wmi_cmd,
114 TP_PROTO(int id, void *buf, size_t buf_len, int ret),
116 TP_ARGS(id, buf, buf_len, ret),
118 TP_STRUCT__entry(
119 __field(unsigned int, id)
120 __field(size_t, buf_len)
121 __dynamic_array(u8, buf, buf_len)
122 __field(int, ret)
125 TP_fast_assign(
126 __entry->id = id;
127 __entry->buf_len = buf_len;
128 __entry->ret = ret;
129 memcpy(__get_dynamic_array(buf), buf, buf_len);
132 TP_printk(
133 "id %d len %zu ret %d",
134 __entry->id,
135 __entry->buf_len,
136 __entry->ret
140 TRACE_EVENT(ath10k_wmi_event,
141 TP_PROTO(int id, void *buf, size_t buf_len),
143 TP_ARGS(id, buf, buf_len),
145 TP_STRUCT__entry(
146 __field(unsigned int, id)
147 __field(size_t, buf_len)
148 __dynamic_array(u8, buf, buf_len)
151 TP_fast_assign(
152 __entry->id = id;
153 __entry->buf_len = buf_len;
154 memcpy(__get_dynamic_array(buf), buf, buf_len);
157 TP_printk(
158 "id %d len %zu",
159 __entry->id,
160 __entry->buf_len
164 TRACE_EVENT(ath10k_htt_stats,
165 TP_PROTO(void *buf, size_t buf_len),
167 TP_ARGS(buf, buf_len),
169 TP_STRUCT__entry(
170 __field(size_t, buf_len)
171 __dynamic_array(u8, buf, buf_len)
174 TP_fast_assign(
175 __entry->buf_len = buf_len;
176 memcpy(__get_dynamic_array(buf), buf, buf_len);
179 TP_printk(
180 "len %zu",
181 __entry->buf_len
185 TRACE_EVENT(ath10k_wmi_dbglog,
186 TP_PROTO(void *buf, size_t buf_len),
188 TP_ARGS(buf, buf_len),
190 TP_STRUCT__entry(
191 __field(size_t, buf_len)
192 __dynamic_array(u8, buf, buf_len)
195 TP_fast_assign(
196 __entry->buf_len = buf_len;
197 memcpy(__get_dynamic_array(buf), buf, buf_len);
200 TP_printk(
201 "len %zu",
202 __entry->buf_len
206 #endif /* _TRACE_H_ || TRACE_HEADER_MULTI_READ*/
208 /* we don't want to use include/trace/events */
209 #undef TRACE_INCLUDE_PATH
210 #define TRACE_INCLUDE_PATH .
211 #undef TRACE_INCLUDE_FILE
212 #define TRACE_INCLUDE_FILE trace
214 /* This part must be outside protection */
215 #include <trace/define_trace.h>