trace: assign defaults at register_ftrace_event

Impact: simplification of tracers

As all tracers are doing this we might as well do it in
register_ftrace_event and save one branch each time we call these
callbacks.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Frederic Weisbecker <fweisbec@gmail.com>
Acked-by: Steven Rostedt <srostedt@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arnaldo Carvalho de Melo 2009-02-04 20:16:39 -02:00 committed by Ingo Molnar
parent 43769f10b4
commit 268ccda0cb
4 changed files with 16 additions and 15 deletions

View file

@ -435,6 +435,17 @@ int register_ftrace_event(struct trace_event *event)
if (ftrace_find_event(event->type))
goto out;
if (event->trace == NULL)
event->trace = trace_nop_print;
if (event->latency_trace == NULL)
event->latency_trace = trace_nop_print;
if (event->raw == NULL)
event->raw = trace_nop_print;
if (event->hex == NULL)
event->hex = trace_nop_print;
if (event->binary == NULL)
event->binary = trace_nop_print;
key = event->type & (EVENT_HASHSIZE - 1);
hlist_add_head_rcu(&event->node, &event_hash[key]);
@ -874,8 +885,6 @@ static struct trace_event trace_print_event = {
.trace = trace_print_print,
.latency_trace = trace_print_print,
.raw = trace_print_raw,
.hex = trace_nop_print,
.binary = trace_nop_print,
};
static struct trace_event *events[] __initdata = {