提交 f555f123 编写于 作者: A Anton Vorontsov 提交者: Greg Kroah-Hartman

tracing/function: Convert func_set_flag() to a switch statement

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: NSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: NAnton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: NSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 a694d1b5
...@@ -217,10 +217,11 @@ static void tracing_stop_function_trace(void) ...@@ -217,10 +217,11 @@ static void tracing_stop_function_trace(void)
static int func_set_flag(u32 old_flags, u32 bit, int set) 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 */ /* do nothing if already set */
if (!!set == !!(func_flags.val & TRACE_FUNC_OPT_STACK)) if (!!set == !!(func_flags.val & TRACE_FUNC_OPT_STACK))
return 0; break;
if (set) { if (set) {
unregister_ftrace_function(&trace_ops); unregister_ftrace_function(&trace_ops);
...@@ -230,12 +231,14 @@ static int func_set_flag(u32 old_flags, u32 bit, int set) ...@@ -230,12 +231,14 @@ static int func_set_flag(u32 old_flags, u32 bit, int set)
register_ftrace_function(&trace_ops); register_ftrace_function(&trace_ops);
} }
return 0; break;
} else if (bit == TRACE_FUNC_OPT_PSTORE) { case TRACE_FUNC_OPT_PSTORE:
return 0; break;
default:
return -EINVAL;
} }
return -EINVAL; return 0;
} }
static struct tracer function_trace __read_mostly = static struct tracer function_trace __read_mostly =
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册