1 /******************************************************************************
2  *
3  * Copyright(c) 2009 - 2014 Intel Corporation. All rights reserved.
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of version 2 of the GNU General Public License as
7  * published by the Free Software Foundation.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
12  * more details.
13  *
14  * The full GNU General Public License is included in this distribution in the
15  * file called LICENSE.
16  *
17  * Contact Information:
18  *  Intel Linux Wireless <linuxwifi@intel.com>
19  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
20  *
21  *****************************************************************************/
22 
23 #if !defined(__IWLWIFI_DEVICE_TRACE_MSG) || defined(TRACE_HEADER_MULTI_READ)
24 #define __IWLWIFI_DEVICE_TRACE_MSG
25 
26 #include <linux/tracepoint.h>
27 
28 #undef TRACE_SYSTEM
29 #define TRACE_SYSTEM iwlwifi_msg
30 
31 #define MAX_MSG_LEN	110
32 
33 DECLARE_EVENT_CLASS(iwlwifi_msg_event,
34 	TP_PROTO(struct va_format *vaf),
35 	TP_ARGS(vaf),
36 	TP_STRUCT__entry(
37 		__dynamic_array(char, msg, MAX_MSG_LEN)
38 	),
39 	TP_fast_assign(
40 		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
41 				       MAX_MSG_LEN, vaf->fmt,
42 				       *vaf->va) >= MAX_MSG_LEN);
43 	),
44 	TP_printk("%s", __get_str(msg))
45 );
46 
47 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err,
48 	TP_PROTO(struct va_format *vaf),
49 	TP_ARGS(vaf)
50 );
51 
52 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn,
53 	TP_PROTO(struct va_format *vaf),
54 	TP_ARGS(vaf)
55 );
56 
57 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info,
58 	TP_PROTO(struct va_format *vaf),
59 	TP_ARGS(vaf)
60 );
61 
62 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit,
63 	TP_PROTO(struct va_format *vaf),
64 	TP_ARGS(vaf)
65 );
66 
67 TRACE_EVENT(iwlwifi_dbg,
68 	TP_PROTO(u32 level, bool in_interrupt, const char *function,
69 		 struct va_format *vaf),
70 	TP_ARGS(level, in_interrupt, function, vaf),
71 	TP_STRUCT__entry(
72 		__field(u32, level)
73 		__field(u8, in_interrupt)
74 		__string(function, function)
75 		__dynamic_array(char, msg, MAX_MSG_LEN)
76 	),
77 	TP_fast_assign(
78 		__entry->level = level;
79 		__entry->in_interrupt = in_interrupt;
80 		__assign_str(function, function);
81 		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
82 				       MAX_MSG_LEN, vaf->fmt,
83 				       *vaf->va) >= MAX_MSG_LEN);
84 	),
85 	TP_printk("%s", __get_str(msg))
86 );
87 #endif /* __IWLWIFI_DEVICE_TRACE_MSG */
88 
89 #undef TRACE_INCLUDE_PATH
90 #define TRACE_INCLUDE_PATH .
91 #undef TRACE_INCLUDE_FILE
92 #define TRACE_INCLUDE_FILE iwl-devtrace-msg
93 #include <trace/define_trace.h>
94