aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_events_stage_3.h15
-rw-r--r--kernel/trace/trace_output.c5
2 files changed, 19 insertions, 1 deletions
diff --git a/kernel/trace/trace_events_stage_3.h b/kernel/trace/trace_events_stage_3.h
index ae2e323df0c7..4c26d97b4508 100644
--- a/kernel/trace/trace_events_stage_3.h
+++ b/kernel/trace/trace_events_stage_3.h
@@ -130,7 +130,19 @@ static void ftrace_unreg_event_##call(void) \
130{ \ 130{ \
131 unregister_trace_##call(ftrace_event_##call); \ 131 unregister_trace_##call(ftrace_event_##call); \
132} \ 132} \
133 133 \
134static struct ftrace_event_call event_##call; \
135 \
136static int ftrace_init_event_##call(void) \
137{ \
138 int id; \
139 \
140 id = register_ftrace_event(NULL); \
141 if (!id) \
142 return -ENODEV; \
143 event_##call.id = id; \
144 return 0; \
145}
134 146
135#undef TRACE_FORMAT 147#undef TRACE_FORMAT
136#define TRACE_FORMAT(call, proto, args, fmt) \ 148#define TRACE_FORMAT(call, proto, args, fmt) \
@@ -140,6 +152,7 @@ __attribute__((__aligned__(4))) \
140__attribute__((section("_ftrace_events"))) event_##call = { \ 152__attribute__((section("_ftrace_events"))) event_##call = { \
141 .name = #call, \ 153 .name = #call, \
142 .system = __stringify(TRACE_SYSTEM), \ 154 .system = __stringify(TRACE_SYSTEM), \
155 .raw_init = ftrace_init_event_##call, \
143 .regfunc = ftrace_reg_event_##call, \ 156 .regfunc = ftrace_reg_event_##call, \
144 .unregfunc = ftrace_unreg_event_##call, \ 157 .unregfunc = ftrace_unreg_event_##call, \
145} 158}
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index b45141748af5..19261fdd2455 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -481,6 +481,11 @@ int register_ftrace_event(struct trace_event *event)
481 481
482 mutex_lock(&trace_event_mutex); 482 mutex_lock(&trace_event_mutex);
483 483
484 if (!event) {
485 ret = next_event_type++;
486 goto out;
487 }
488
484 if (!event->type) 489 if (!event->type)
485 event->type = next_event_type++; 490 event->type = next_event_type++;
486 else if (event->type > __TRACE_LAST_TYPE) { 491 else if (event->type > __TRACE_LAST_TYPE) {