diff options
author | Steven Rostedt (Red Hat) <rostedt@goodmis.org> | 2013-03-09 14:36:53 +0100 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2013-03-15 05:35:58 +0100 |
commit | 1c31714328be90764e46716f31fb0bd6da44c305 (patch) | |
tree | 749d35b272ef7bc5f7c1ee84070d23afe2b425a5 /kernel/trace/trace_functions.c | |
parent | tracing: Let tracing_snapshot() be used by modules but not NMI (diff) | |
download | linux-1c31714328be90764e46716f31fb0bd6da44c305.tar.xz linux-1c31714328be90764e46716f31fb0bd6da44c305.zip |
tracing: Consolidate updating of count for traceon/off
Remove some duplicate code and replace it with a helper function.
This makes the code a it cleaner.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_functions.c')
-rw-r--r-- | kernel/trace/trace_functions.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/kernel/trace/trace_functions.c b/kernel/trace/trace_functions.c index e467c0c7bdd5..38cfb290ecd9 100644 --- a/kernel/trace/trace_functions.c +++ b/kernel/trace/trace_functions.c @@ -214,38 +214,37 @@ static struct tracer function_trace __read_mostly = }; #ifdef CONFIG_DYNAMIC_FTRACE -static void -ftrace_traceon(unsigned long ip, unsigned long parent_ip, void **data) +static int update_count(void **data) { - long *count = (long *)data; - - if (tracing_is_on()) - return; + unsigned long *count = (long *)data; if (!*count) - return; + return 0; if (*count != -1) (*count)--; - tracing_on(); + return 1; } static void -ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data) +ftrace_traceon(unsigned long ip, unsigned long parent_ip, void **data) { - long *count = (long *)data; - - if (!tracing_is_on()) + if (tracing_is_on()) return; - if (!*count) - return; + if (update_count(data)) + tracing_on(); +} - if (*count != -1) - (*count)--; +static void +ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data) +{ + if (!tracing_is_on()) + return; - tracing_off(); + if (update_count(data)) + tracing_off(); } static int |