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>
This commit is contained in:
parent
1b22e382ab
commit
1c31714328
1 changed files with 16 additions and 17 deletions
|
@ -214,37 +214,36 @@ static struct tracer function_trace __read_mostly =
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef CONFIG_DYNAMIC_FTRACE
|
#ifdef CONFIG_DYNAMIC_FTRACE
|
||||||
static void
|
static int update_count(void **data)
|
||||||
ftrace_traceon(unsigned long ip, unsigned long parent_ip, void **data)
|
|
||||||
{
|
{
|
||||||
long *count = (long *)data;
|
unsigned long *count = (long *)data;
|
||||||
|
|
||||||
if (tracing_is_on())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!*count)
|
if (!*count)
|
||||||
return;
|
return 0;
|
||||||
|
|
||||||
if (*count != -1)
|
if (*count != -1)
|
||||||
(*count)--;
|
(*count)--;
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ftrace_traceon(unsigned long ip, unsigned long parent_ip, void **data)
|
||||||
|
{
|
||||||
|
if (tracing_is_on())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (update_count(data))
|
||||||
tracing_on();
|
tracing_on();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data)
|
ftrace_traceoff(unsigned long ip, unsigned long parent_ip, void **data)
|
||||||
{
|
{
|
||||||
long *count = (long *)data;
|
|
||||||
|
|
||||||
if (!tracing_is_on())
|
if (!tracing_is_on())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!*count)
|
if (update_count(data))
|
||||||
return;
|
|
||||||
|
|
||||||
if (*count != -1)
|
|
||||||
(*count)--;
|
|
||||||
|
|
||||||
tracing_off();
|
tracing_off();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue