Skip to content

Commit

Permalink
tracing/function: Convert func_set_flag() to a switch statement
Browse files Browse the repository at this point in the history
Since the function accepts just one bit, we can use the switch
construction instead of if/else if/...

Just a cosmetic change, there should be no functional changes.

Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Anton Vorontsov authored and Greg Kroah-Hartman committed Jul 17, 2012
1 parent a694d1b commit f555f12
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions kernel/trace/trace_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,11 @@ static void tracing_stop_function_trace(void)

static int func_set_flag(u32 old_flags, u32 bit, int set)
{
if (bit == TRACE_FUNC_OPT_STACK) {
switch (bit) {
case TRACE_FUNC_OPT_STACK:
/* do nothing if already set */
if (!!set == !!(func_flags.val & TRACE_FUNC_OPT_STACK))
return 0;
break;

if (set) {
unregister_ftrace_function(&trace_ops);
Expand All @@ -230,12 +231,14 @@ static int func_set_flag(u32 old_flags, u32 bit, int set)
register_ftrace_function(&trace_ops);
}

return 0;
} else if (bit == TRACE_FUNC_OPT_PSTORE) {
return 0;
break;
case TRACE_FUNC_OPT_PSTORE:
break;
default:
return -EINVAL;
}

return -EINVAL;
return 0;
}

static struct tracer function_trace __read_mostly =
Expand Down

0 comments on commit f555f12

Please sign in to comment.