tracing: Extract duplicate ftrace_raw_init_event_foo()
[firefly-linux-kernel-4.4.55.git] / include / trace / ftrace.h
index c4eca380204e7b7a47e97c69c93502515db4943a..6055b0604c86f0b4e0c87831307d03c151d0213c 100644 (file)
@@ -623,23 +623,12 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
  *     .trace                  = ftrace_raw_output_<call>, <-- stage 2
  * };
  *
- * static int ftrace_raw_init_event_<call>(struct ftrace_event_call *unused)
- * {
- *     int id;
- *
- *     id = register_ftrace_event(&ftrace_event_type_<call>);
- *     if (!id)
- *             return -ENODEV;
- *     event_<call>.id = id;
- *     return 0;
- * }
- *
  * static struct ftrace_event_call __used
  * __attribute__((__aligned__(4)))
  * __attribute__((section("_ftrace_events"))) event_<call> = {
  *     .name                   = "<call>",
  *     .system                 = "<system>",
- *     .raw_init               = ftrace_raw_init_event_<call>,
+ *     .raw_init               = trace_event_raw_init,
  *     .regfunc                = ftrace_reg_event_<call>,
  *     .unregfunc              = ftrace_unreg_event_<call>,
  *     .show_format            = ftrace_format_<call>,
@@ -647,9 +636,6 @@ static void ftrace_profile_disable_##name(struct ftrace_event_call *unused)\
  *
  */
 
-#undef TP_FMT
-#define TP_FMT(fmt, args...)   fmt "\n", ##args
-
 #ifdef CONFIG_EVENT_PROFILE
 
 #define _TRACE_PROFILE_INIT(call)                                      \
@@ -744,19 +730,7 @@ static void ftrace_raw_unreg_event_##call(struct ftrace_event_call *unused)\
                                                                        \
 static struct trace_event ftrace_event_type_##call = {                 \
        .trace                  = ftrace_raw_output_##call,             \
-};                                                                     \
-                                                                       \
-static int ftrace_raw_init_event_##call(struct ftrace_event_call *unused)\
-{                                                                      \
-       int id;                                                         \
-                                                                       \
-       id = register_ftrace_event(&ftrace_event_type_##call);          \
-       if (!id)                                                        \
-               return -ENODEV;                                         \
-       event_##call.id = id;                                           \
-       INIT_LIST_HEAD(&event_##call.fields);                           \
-       return 0;                                                       \
-}
+};
 
 #undef DEFINE_EVENT_PRINT
 #define DEFINE_EVENT_PRINT(template, name, proto, args, print) \
@@ -776,7 +750,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
        .name                   = #call,                                \
        .system                 = __stringify(TRACE_SYSTEM),            \
        .event                  = &ftrace_event_type_##call,            \
-       .raw_init               = ftrace_raw_init_event_##call,         \
+       .raw_init               = trace_event_raw_init,                 \
        .regfunc                = ftrace_raw_reg_event_##call,          \
        .unregfunc              = ftrace_raw_unreg_event_##call,        \
        .show_format            = ftrace_format_##template,             \
@@ -793,7 +767,7 @@ __attribute__((section("_ftrace_events"))) event_##call = {         \
        .name                   = #call,                                \
        .system                 = __stringify(TRACE_SYSTEM),            \
        .event                  = &ftrace_event_type_##call,            \
-       .raw_init               = ftrace_raw_init_event_##call,         \
+       .raw_init               = trace_event_raw_init,                 \
        .regfunc                = ftrace_raw_reg_event_##call,          \
        .unregfunc              = ftrace_raw_unreg_event_##call,        \
        .show_format            = ftrace_format_##call,                 \
@@ -953,7 +927,6 @@ end:                                                                        \
        perf_swevent_put_recursion_context(rctx);                       \
 end_recursion:                                                         \
        local_irq_restore(irq_flags);                                   \
-                                                                       \
 }
 
 #undef DEFINE_EVENT