compat: fix warning on trace backport for 2.6.29 and older
[~emulex/for-vlad/old/compat.git] / include / linux / tracepoint.h
1 #ifndef _COMPAT_LINUX_TRACEPOINT_H
2 #define _COMPAT_LINUX_TRACEPOINT_H 1
3
4 #include <linux/version.h>
5
6 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27))
7
8 #include_next <linux/tracepoint.h>
9
10 /* Backports f42c85e7 */
11 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
12 #undef TP_STRUCT__entry
13 #define TP_STRUCT__entry(args...) args
14 #endif
15
16 /* Backports 091ad365, a rename */
17 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
18 #define DECLARE_EVENT_CLASS TRACE_EVENT_TEMPLATE
19 #endif
20
21 /* Backpports 2939b0469 */
22 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
23 #define TP_PROTO TPPROTO
24 #define TP_ARGS TPARGS
25 #define TP_FMT TPFMT
26 #define TP_RAW_FMT TPRAWFMT
27 #endif
28
29 /* Force disabling tracing */
30
31 #undef PARAMS
32 #define PARAMS(args...) args
33
34 #undef TRACE_EVENT
35 #define TRACE_EVENT(name, proto, ...) \
36 DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
37
38 #undef DECLARE_EVENT_CLASS
39 #define DECLARE_EVENT_CLASS(...)
40 #undef DEFINE_EVENT
41
42 #define DEFINE_EVENT(template, name, proto, args)               \
43         DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
44
45 #undef DECLARE_TRACE_NOARGS
46 #define DECLARE_TRACE_NOARGS(name)                                      \
47                 __DECLARE_TRACE(name, void, , 1, void *__data, __data)
48
49
50 /* Backports 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e */
51 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
52
53 #undef DECLARE_TRACE
54 #define DECLARE_TRACE(name, proto, args)                                \
55                 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1,   \
56                                 PARAMS(void *__data, proto),            \
57                                 PARAMS(__data, args))
58
59 #undef DECLARE_TRACE_CONDITION
60 #define DECLARE_TRACE_CONDITION(name, proto, args, cond)                \
61         __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \
62                         PARAMS(void *__data, proto),                    \
63                         PARAMS(__data, args))
64
65 #else
66
67 #undef DECLARE_TRACE
68 #define DECLARE_TRACE(name, proto, args)                                \
69                 __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1,   \
70                                 PARAMS(void *__data, proto),            \
71                                 PARAMS(__data, args))
72
73 #undef DECLARE_TRACE_CONDITION
74 #define DECLARE_TRACE_CONDITION(name, proto, args, cond)                \
75         __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \
76                         PARAMS(void *__data, proto),                    \
77                         PARAMS(__data, args))
78 #endif /* backport 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e */
79
80 /* Backports 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e */
81 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,35))
82
83 /* Backports c420970ef476d7d68df119711700666224001f43 */
84 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30))
85
86 #undef __DECLARE_TRACE
87 #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
88         static inline void trace_##name(proto)                          \
89         { }                                                             \
90         static inline void trace_##name##_rcuidle(proto)                \
91         { }                                                             \
92         static inline int                                               \
93         register_trace_##name(void (*probe)(proto))                     \
94         {                                                               \
95                 return -ENOSYS;                                         \
96         }                                                               \
97         static inline void                                              \
98         unregister_trace_##name(void (*probe)(proto))                   \
99         {                                                               \
100         }                                                               \
101         static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
102         {                                                               \
103         }
104 #else
105
106 #undef __DECLARE_TRACE
107 #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
108         static inline void trace_##name(proto)                          \
109         { }                                                             \
110         static inline void trace_##name##_rcuidle(proto)                \
111         { }                                                             \
112         static inline int                                               \
113         register_trace_##name(void (*probe)(proto))                     \
114         {                                                               \
115                 return -ENOSYS;                                         \
116         }                                                               \
117         static inline int                                               \
118         unregister_trace_##name(void (*probe)(proto))                   \
119         {                                                               \
120                 return -ENOSYS;                                         \
121         }                                                               \
122         static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
123         {                                                               \
124         }
125 #endif /* backport c420970ef476d7d68df119711700666224001f43 */
126
127 #else
128
129 #undef __DECLARE_TRACE
130 #define __DECLARE_TRACE(name, proto, args, cond, data_proto, data_args) \
131         static inline void trace_##name(proto)                          \
132         { }                                                             \
133         static inline void trace_##name##_rcuidle(proto)                \
134         { }                                                             \
135         static inline int                                               \
136         register_trace_##name(void (*probe)(data_proto),                \
137                               void *data)                               \
138         {                                                               \
139                 return -ENOSYS;                                         \
140         }                                                               \
141         static inline int                                               \
142         unregister_trace_##name(void (*probe)(data_proto),              \
143                                 void *data)                             \
144         {                                                               \
145                 return -ENOSYS;                                         \
146         }                                                               \
147         static inline void check_trace_callback_type_##name(void (*cb)(data_proto)) \
148         {                                                               \
149         }
150
151 #endif /* backport 38516ab59fbc5b3bb278cf5e1fe2867c70cff32e */
152
153 #undef DEFINE_TRACE_FN
154 #define DEFINE_TRACE_FN(name, reg, unreg)
155
156 #undef DEFINE_TRACE
157 #define DEFINE_TRACE(name)
158
159 #undef EXPORT_TRACEPOINT_SYMBOL_GPL
160 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
161
162 #undef EXPORT_TRACEPOINT_SYMBOL
163 #define EXPORT_TRACEPOINT_SYMBOL(name)
164
165 #ifdef CONFIG_TRACEPOINTS
166 #else /* CONFIG_TRACEPOINTS */
167 #endif /* CONFIG_TRACEPOINTS */
168
169 #else /* just disable tracing */
170
171 /* Disable all tracing */
172 #undef TRACE_EVENT
173 #define TRACE_EVENT(name, proto, ...) \
174 static inline void trace_ ## name(proto) {}
175 #undef DECLARE_EVENT_CLASS
176 #define DECLARE_EVENT_CLASS(...)
177 #undef DEFINE_EVENT
178 #define DEFINE_EVENT(evt_class, name, proto, ...) \
179 static inline void trace_ ## name(proto) {}
180
181 #define TP_PROTO(args...)  args
182 #define TP_ARGS(args...)   args
183 #define TP_CONDITION(args...)      args
184
185 #endif /* (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,27)) */
186
187 #endif  /* _COMPAT_LINUX_TRACEPOINT_H */