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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  * The full GNU General Public License is included in this distribution in the
19  * file called LICENSE.
20  *
21  * Contact Information:
22  *  Intel Linux Wireless <linuxwifi@intel.com>
23  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
24  *
25  *****************************************************************************/
26 
27 #if !defined(__IWLWIFI_DEVICE_TRACE_MSG) || defined(TRACE_HEADER_MULTI_READ)
28 #define __IWLWIFI_DEVICE_TRACE_MSG
29 
30 #include <linux/tracepoint.h>
31 
32 #undef TRACE_SYSTEM
33 #define TRACE_SYSTEM iwlwifi_msg
34 
35 #define MAX_MSG_LEN	110
36 
37 DECLARE_EVENT_CLASS(iwlwifi_msg_event,
38 	TP_PROTO(struct va_format *vaf),
39 	TP_ARGS(vaf),
40 	TP_STRUCT__entry(
41 		__dynamic_array(char, msg, MAX_MSG_LEN)
42 	),
43 	TP_fast_assign(
44 		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
45 				       MAX_MSG_LEN, vaf->fmt,
46 				       *vaf->va) >= MAX_MSG_LEN);
47 	),
48 	TP_printk("%s", __get_str(msg))
49 );
50 
51 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_err,
52 	TP_PROTO(struct va_format *vaf),
53 	TP_ARGS(vaf)
54 );
55 
56 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_warn,
57 	TP_PROTO(struct va_format *vaf),
58 	TP_ARGS(vaf)
59 );
60 
61 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_info,
62 	TP_PROTO(struct va_format *vaf),
63 	TP_ARGS(vaf)
64 );
65 
66 DEFINE_EVENT(iwlwifi_msg_event, iwlwifi_crit,
67 	TP_PROTO(struct va_format *vaf),
68 	TP_ARGS(vaf)
69 );
70 
71 TRACE_EVENT(iwlwifi_dbg,
72 	TP_PROTO(u32 level, bool in_interrupt, const char *function,
73 		 struct va_format *vaf),
74 	TP_ARGS(level, in_interrupt, function, vaf),
75 	TP_STRUCT__entry(
76 		__field(u32, level)
77 		__field(u8, in_interrupt)
78 		__string(function, function)
79 		__dynamic_array(char, msg, MAX_MSG_LEN)
80 	),
81 	TP_fast_assign(
82 		__entry->level = level;
83 		__entry->in_interrupt = in_interrupt;
84 		__assign_str(function, function);
85 		WARN_ON_ONCE(vsnprintf(__get_dynamic_array(msg),
86 				       MAX_MSG_LEN, vaf->fmt,
87 				       *vaf->va) >= MAX_MSG_LEN);
88 	),
89 	TP_printk("%s", __get_str(msg))
90 );
91 #endif /* __IWLWIFI_DEVICE_TRACE_MSG */
92 
93 #undef TRACE_INCLUDE_PATH
94 #define TRACE_INCLUDE_PATH .
95 #undef TRACE_INCLUDE_FILE
96 #define TRACE_INCLUDE_FILE iwl-devtrace-msg
97 #include <trace/define_trace.h>
98