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, bool in_interrupt, const char *function,
58 		 struct va_format *vaf),
59 	TP_ARGS(level, in_interrupt, function, vaf),
60 	TP_STRUCT__entry(
61 		__field(u32, level)
62 		__field(u8, in_interrupt)
63 		__string(function, function)
64 		__dynamic_array(char, msg, MAX_MSG_LEN)
65 	),
66 	TP_fast_assign(
67 		__entry->level = level;
68 		__entry->in_interrupt = in_interrupt;
69 		__assign_str(function, function);
70 		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
71 				       MAX_MSG_LEN, vaf->fmt,
72 				       *vaf->va) >= MAX_MSG_LEN);
73 	),
74 	TP_printk("%s", __get_str(msg))
75 );
76 #endif /* __IWLWIFI_DEVICE_TRACE_MSG */
77 
78 #undef TRACE_INCLUDE_PATH
79 #define TRACE_INCLUDE_PATH .
80 #undef TRACE_INCLUDE_FILE
81 #define TRACE_INCLUDE_FILE iwl-devtrace-msg
82 #include <trace/define_trace.h>
83