浏览代码

tracing: Consolidate ftrace_trace_onoff_unreg() into callback

The only thing ftrace_trace_onoff_unreg() does is to do a strcmp()
against the cmd parameter to determine what op to unregister. But
this compare is also done after the location that this function is
called (and returns). By moving the check for '!' to unregister after
the strcmp(), the callback function itself can just do the unregister
and we can get rid of the helper function.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Steven Rostedt (Red Hat) 12 年之前
父节点
当前提交
8b8fa62c60
共有 1 个文件被更改,包括 5 次插入19 次删除
  1. 5 19
      kernel/trace/trace_functions.c

+ 5 - 19
kernel/trace/trace_functions.c

@@ -282,22 +282,6 @@ ftrace_trace_onoff_print(struct seq_file *m, unsigned long ip,
 	return 0;
 	return 0;
 }
 }
 
 
-static int
-ftrace_trace_onoff_unreg(char *glob, char *cmd, char *param)
-{
-	struct ftrace_probe_ops *ops;
-
-	/* we register both traceon and traceoff to this callback */
-	if (strcmp(cmd, "traceon") == 0)
-		ops = &traceon_probe_ops;
-	else
-		ops = &traceoff_probe_ops;
-
-	unregister_ftrace_function_probe_func(glob, ops);
-
-	return 0;
-}
-
 static int
 static int
 ftrace_trace_onoff_callback(struct ftrace_hash *hash,
 ftrace_trace_onoff_callback(struct ftrace_hash *hash,
 			    char *glob, char *cmd, char *param, int enable)
 			    char *glob, char *cmd, char *param, int enable)
@@ -311,15 +295,17 @@ ftrace_trace_onoff_callback(struct ftrace_hash *hash,
 	if (!enable)
 	if (!enable)
 		return -EINVAL;
 		return -EINVAL;
 
 
-	if (glob[0] == '!')
-		return ftrace_trace_onoff_unreg(glob+1, cmd, param);
-
 	/* we register both traceon and traceoff to this callback */
 	/* we register both traceon and traceoff to this callback */
 	if (strcmp(cmd, "traceon") == 0)
 	if (strcmp(cmd, "traceon") == 0)
 		ops = &traceon_probe_ops;
 		ops = &traceon_probe_ops;
 	else
 	else
 		ops = &traceoff_probe_ops;
 		ops = &traceoff_probe_ops;
 
 
+	if (glob[0] == '!') {
+		unregister_ftrace_function_probe_func(glob+1, ops);
+		return 0;
+	}
+
 	if (!param)
 	if (!param)
 		goto out_reg;
 		goto out_reg;