libata-sff: ap->[last_]ctl are SFF specific
[safe/jmp/linux-2.6] / include / linux / tracepoint.h
index 0341f2e..78b4bd3 100644 (file)
@@ -4,7 +4,7 @@
 /*
  * Kernel Tracepoint API.
  *
- * See Documentation/tracepoint.txt.
+ * See Documentation/trace/tracepoints.txt.
  *
  * (C) Copyright 2008 Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
  *
@@ -23,6 +23,8 @@ struct tracepoint;
 struct tracepoint {
        const char *name;               /* Tracepoint name */
        int state;                      /* State. */
+       void (*regfunc)(void);
+       void (*unregfunc)(void);
        void **funcs;
 } __attribute__((aligned(32)));                /*
                                         * Aligned on 32 bytes because it is
@@ -34,7 +36,7 @@ struct tracepoint {
 #ifndef DECLARE_TRACE
 
 #define TP_PROTO(args...)      args
-#define TP_ARGS(args...)               args
+#define TP_ARGS(args...)       args
 
 #ifdef CONFIG_TRACEPOINTS
 
@@ -47,7 +49,7 @@ struct tracepoint {
                void **it_func;                                         \
                                                                        \
                rcu_read_lock_sched_notrace();                          \
-               it_func = rcu_dereference((tp)->funcs);                 \
+               it_func = rcu_dereference_sched((tp)->funcs);           \
                if (it_func) {                                          \
                        do {                                            \
                                ((void(*)(proto))(*it_func))(args);     \
@@ -60,10 +62,8 @@ struct tracepoint {
  * Make sure the alignment of the structure in the __tracepoints section will
  * not add unwanted padding between the beginning of the section and the
  * structure. Force alignment to the same alignment as the section start.
- * An optional set of (un)registration functions can be passed to perform any
- * additional (un)registration work.
  */
-#define DECLARE_TRACE_WITH_CALLBACK(name, proto, args, reg, unreg)     \
+#define DECLARE_TRACE(name, proto, args)                               \
        extern struct tracepoint __tracepoint_##name;                   \
        static inline void trace_##name(proto)                          \
        {                                                               \
@@ -73,36 +73,23 @@ struct tracepoint {
        }                                                               \
        static inline int register_trace_##name(void (*probe)(proto))   \
        {                                                               \
-               int ret;                                                \
-               void (*func)(void) = reg;                               \
-                                                                       \
-               ret = tracepoint_probe_register(#name, (void *)probe);  \
-               if (func && !ret)                                       \
-                       func();                                         \
-               return ret;                                             \
+               return tracepoint_probe_register(#name, (void *)probe); \
        }                                                               \
        static inline int unregister_trace_##name(void (*probe)(proto)) \
        {                                                               \
-               int ret;                                                \
-               void (*func)(void) = unreg;                             \
-                                                                       \
-               ret = tracepoint_probe_unregister(#name, (void *)probe);\
-               if (func && !ret)                                       \
-                       func();                                         \
-               return ret;                                             \
+               return tracepoint_probe_unregister(#name, (void *)probe);\
        }
 
 
-#define DECLARE_TRACE(name, proto, args)                                \
-       DECLARE_TRACE_WITH_CALLBACK(name, TP_PROTO(proto), TP_ARGS(args),\
-                                       NULL, NULL);
-
-#define DEFINE_TRACE(name)                                             \
+#define DEFINE_TRACE_FN(name, reg, unreg)                              \
        static const char __tpstrtab_##name[]                           \
        __attribute__((section("__tracepoints_strings"))) = #name;      \
        struct tracepoint __tracepoint_##name                           \
        __attribute__((section("__tracepoints"), aligned(32))) =        \
-               { __tpstrtab_##name, 0, NULL }
+               { __tpstrtab_##name, 0, reg, unreg, NULL }
+
+#define DEFINE_TRACE(name)                                             \
+       DEFINE_TRACE_FN(name, NULL, NULL);
 
 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)                             \
        EXPORT_SYMBOL_GPL(__tracepoint_##name)
@@ -113,7 +100,7 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
        struct tracepoint *end);
 
 #else /* !CONFIG_TRACEPOINTS */
-#define DECLARE_TRACE_WITH_CALLBACK(name, proto, args, reg, unreg)     \
+#define DECLARE_TRACE(name, proto, args)                               \
        static inline void _do_trace_##name(struct tracepoint *tp, proto) \
        { }                                                             \
        static inline void trace_##name(proto)                          \
@@ -127,10 +114,7 @@ extern void tracepoint_update_probe_range(struct tracepoint *begin,
                return -ENOSYS;                                         \
        }
 
-#define DECLARE_TRACE(name, proto, args)                                \
-       DECLARE_TRACE_WITH_CALLBACK(name, TP_PROTO(proto), TP_ARGS(args),\
-                                       NULL, NULL);
-
+#define DEFINE_TRACE_FN(name, reg, unreg)
 #define DEFINE_TRACE(name)
 #define EXPORT_TRACEPOINT_SYMBOL_GPL(name)
 #define EXPORT_TRACEPOINT_SYMBOL(name)
@@ -291,9 +275,21 @@ static inline void tracepoint_synchronize_unregister(void)
  * can also by used by generic instrumentation like SystemTap), and
  * it is also used to expose a structured trace record in
  * /sys/kernel/debug/tracing/events/.
+ *
+ * A set of (un)registration functions can be passed to the variant
+ * TRACE_EVENT_FN to perform any (un)registration work.
  */
 
+#define DECLARE_EVENT_CLASS(name, proto, args, tstruct, assign, print)
+#define DEFINE_EVENT(template, name, proto, args)              \
+       DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
+       DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+
 #define TRACE_EVENT(name, proto, args, struct, assign, print)  \
        DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
+#define TRACE_EVENT_FN(name, proto, args, struct,              \
+               assign, print, reg, unreg)                      \
+       DECLARE_TRACE(name, PARAMS(proto), PARAMS(args))
 
 #endif /* ifdef TRACE_EVENT (see note above) */