1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /******************************************************************************
3  *
4  * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
5  *****************************************************************************/
6 
7 #if !defined(__IWLWIFI_DEVICE_TRACE_MSG) || defined(TRACE_HEADER_MULTI_READ)
8 #define __IWLWIFI_DEVICE_TRACE_MSG
9 
10 #include <linux/tracepoint.h>
11 
12 #undef TRACE_SYSTEM
13 #define TRACE_SYSTEM iwlwifi_msg
14 
15 #define MAX_MSG_LEN	110
16 
17 DECLARE_EVENT_CLASS(iwlwifi_msg_event,
18 	TP_PROTO(struct va_format *vaf),
19 	TP_ARGS(vaf),
20 	TP_STRUCT__entry(
21 		__dynamic_array(char, msg, MAX_MSG_LEN)
22 	),
23 	TP_fast_assign(
24 		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
25 				       MAX_MSG_LEN, vaf->fmt,
26 				       *vaf->va) >= MAX_MSG_LEN);
27 	),
28 	TP_printk("%s", __get_str(msg))
29 );
30 
31 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err,
32 	TP_PROTO(struct va_format *vaf),
33 	TP_ARGS(vaf)
34 );
35 
36 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn,
37 	TP_PROTO(struct va_format *vaf),
38 	TP_ARGS(vaf)
39 );
40 
41 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info,
42 	TP_PROTO(struct va_format *vaf),
43 	TP_ARGS(vaf)
44 );
45 
46 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit,
47 	TP_PROTO(struct va_format *vaf),
48 	TP_ARGS(vaf)
49 );
50 
51 TRACE_EVENT(iwlwifi_dbg,
52 	TP_PROTO(u32 level, const char *function,
53 		 struct va_format *vaf),
54 	TP_ARGS(level, function, vaf),
55 	TP_STRUCT__entry(
56 		__field(u32, level)
57 		__string(function, function)
58 		__dynamic_array(char, msg, MAX_MSG_LEN)
59 	),
60 	TP_fast_assign(
61 		__entry->level = level;
62 		__assign_str(function, function);
63 		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
64 				       MAX_MSG_LEN, vaf->fmt,
65 				       *vaf->va) >= MAX_MSG_LEN);
66 	),
67 	TP_printk("%s", __get_str(msg))
68 );
69 #endif /* __IWLWIFI_DEVICE_TRACE_MSG */
70 
71 #undef TRACE_INCLUDE_PATH
72 #define TRACE_INCLUDE_PATH .
73 #undef TRACE_INCLUDE_FILE
74 #define TRACE_INCLUDE_FILE iwl-devtrace-msg
75 #include <trace/define_trace.h>
76