]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
ftrace: Replace (void *)1 with a meaningful macro name FTRACE_GRAPH_EMPTY
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 2 Feb 2017 15:15:22 +0000 (10:15 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Fri, 3 Feb 2017 15:58:48 +0000 (10:58 -0500)
When the set_graph_function or set_graph_notrace contains no records, a
banner is displayed of either "#### all functions enabled ####" or
"#### all functions disabled ####" respectively. To tell the seq operations
to do this, (void *)1 is passed as a return value. Instead of using a
hardcoded meaningless variable, define it as a macro.

Acked-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ftrace.c

index 1595df0d7d7908241a9eb0f50a63f6bc5d48aa92..a9cfc871319814c4e92b25b08143632e0828f208 100644 (file)
@@ -4561,6 +4561,8 @@ enum graph_filter_type {
        GRAPH_FILTER_FUNCTION,
 };
 
+#define FTRACE_GRAPH_EMPTY     ((void *)1)
+
 struct ftrace_graph_data {
        struct ftrace_hash *hash;
        struct ftrace_func_entry *entry;
@@ -4616,7 +4618,7 @@ static void *g_start(struct seq_file *m, loff_t *pos)
 
        /* Nothing, tell g_show to print all functions are enabled */
        if (ftrace_hash_empty(fgd->hash) && !*pos)
-               return (void *)1;
+               return FTRACE_GRAPH_EMPTY;
 
        fgd->idx = 0;
        fgd->entry = NULL;
@@ -4635,7 +4637,7 @@ static int g_show(struct seq_file *m, void *v)
        if (!entry)
                return 0;
 
-       if (entry == (void *)1) {
+       if (entry == FTRACE_GRAPH_EMPTY) {
                struct ftrace_graph_data *fgd = m->private;
 
                if (fgd->type == GRAPH_FILTER_FUNCTION)