aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>2010-04-30 12:59:59 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-05-14 09:34:26 -0400
commit53da59aa6dd881fd0bbdd058a8a299d90ce9dd1d (patch)
tree53b68f57d815025ee6f97900544b4cfecca0d78d
parent8f0820183056ad26dabc0202115848a92f1143fc (diff)
tracepoints: Add check trace callback type
This check is meant to be used by tracepoint users which do a direct cast of callbacks to (void *) for direct registration, thus bypassing the register_trace_##name and unregister_trace_##name checks. This permits to ensure that the callback type matches the function type at the call site, but without generating any code. Acked-by: Masami Hiramatsu <mhiramat@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> LKML-Reference: <20100430165959.GA25605@Krystal> CC: Ingo Molnar <mingo@elte.hu> CC: Andrew Morton <akpm@linux-foundation.org> CC: Thomas Gleixner <tglx@linutronix.de> CC: Peter Zijlstra <peterz@infradead.org> CC: Arnaldo Carvalho de Melo <acme@redhat.com> CC: Lai Jiangshan <laijs@cn.fujitsu.com> CC: Li Zefan <lizf@cn.fujitsu.com> CC: Christoph Hellwig <hch@lst.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--include/linux/tracepoint.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index 1d85f9a6a199..8d5e4f6d96d0 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -137,9 +137,11 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
137 static inline int unregister_trace_##name(void (*probe)(proto)) \ 137 static inline int unregister_trace_##name(void (*probe)(proto)) \
138 { \ 138 { \
139 return tracepoint_probe_unregister(#name, (void *)probe);\ 139 return tracepoint_probe_unregister(#name, (void *)probe);\
140 } \
141 static inline void check_trace_callback_type_##name(void (*cb)(proto)) \
142 { \
140 } 143 }
141 144
142
143#define DEFINE_TRACE_FN(name, reg, unreg) \ 145#define DEFINE_TRACE_FN(name, reg, unreg) \
144 static const char __tpstrtab_##name[] \ 146 static const char __tpstrtab_##name[] \
145 __attribute__((section("__tracepoints_strings"))) = #name; \ 147 __attribute__((section("__tracepoints_strings"))) = #name; \
@@ -168,6 +170,9 @@ static inline void tracepoint_update_probe_range(struct tracepoint *begin,
168 static inline int unregister_trace_##name(void (*probe)(proto)) \ 170 static inline int unregister_trace_##name(void (*probe)(proto)) \
169 { \ 171 { \
170 return -ENOSYS; \ 172 return -ENOSYS; \
173 } \
174 static inline void check_trace_callback_type_##name(void (*cb)(proto)) \
175 { \
171 } 176 }
172 177
173#define DEFINE_TRACE_FN(name, reg, unreg) 178#define DEFINE_TRACE_FN(name, reg, unreg)