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