trace: Replace single-character seq_puts with seq_putc
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Sat, 8 Nov 2014 20:42:12 +0000 (21:42 +0100)
committerSteven Rostedt <rostedt@goodmis.org>
Fri, 14 Nov 2014 12:55:55 +0000 (07:55 -0500)
Printing a single character to a seqfile might as well be done with
seq_putc instead of seq_puts; this avoids a strlen() call and a memory
access. It also shaves another few bytes off the generated code.

Link: http://lkml.kernel.org/r/1415479332-25944-4-git-send-email-linux@rasmusvillemoes.dk
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
kernel/trace/trace_events_trigger.c
kernel/trace/trace_functions_graph.c
kernel/trace/trace_kprobe.c
kernel/trace/trace_printk.c
kernel/trace/trace_uprobe.c

index 3d89ffc6674037e4d6710199cd637047d9b741f8..8712df9decb4408cbeaf46e1edaf7c64a1feb15a 100644 (file)
@@ -383,7 +383,7 @@ event_trigger_print(const char *name, struct seq_file *m,
        if (filter_str)
                seq_printf(m, " if %s\n", filter_str);
        else
-               seq_puts(m, "\n");
+               seq_putc(m, '\n');
 
        return 0;
 }
@@ -1105,7 +1105,7 @@ event_enable_trigger_print(struct seq_file *m, struct event_trigger_ops *ops,
        if (data->filter_str)
                seq_printf(m, " if %s\n", data->filter_str);
        else
-               seq_puts(m, "\n");
+               seq_putc(m, '\n');
 
        return 0;
 }
index 29ba611e6f5781968dd3b01de9b0e1b5aa62066c..a82d1d3bd76dbba6e2f99f77bb8988d7e7defe5d 100644 (file)
@@ -1407,7 +1407,7 @@ static void __print_graph_headers_flags(struct seq_file *s, u32 flags)
                print_lat_header(s, flags);
 
        /* 1st line */
-       seq_puts(s, "#");
+       seq_putc(s, '#');
        if (flags & TRACE_GRAPH_PRINT_ABS_TIME)
                seq_puts(s, "     TIME       ");
        if (flags & TRACE_GRAPH_PRINT_CPU)
@@ -1421,7 +1421,7 @@ static void __print_graph_headers_flags(struct seq_file *s, u32 flags)
        seq_puts(s, "               FUNCTION CALLS\n");
 
        /* 2nd line */
-       seq_puts(s, "#");
+       seq_putc(s, '#');
        if (flags & TRACE_GRAPH_PRINT_ABS_TIME)
                seq_puts(s, "      |         ");
        if (flags & TRACE_GRAPH_PRINT_CPU)
index 240d27ddf82ef7471b06ae038ac527a87a7634d2..ef7e7f16ed1a9c0a07088ef6479d3f9df429c1d4 100644 (file)
@@ -1030,7 +1030,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags,
        if (!seq_print_ip_sym(s, field->ip, flags | TRACE_ITER_SYM_OFFSET))
                goto partial;
 
-       if (!trace_seq_puts(s, ")"))
+       if (!trace_seq_putc(s, ')'))
                goto partial;
 
        data = (u8 *)&field[1];
@@ -1039,7 +1039,7 @@ print_kprobe_event(struct trace_iterator *iter, int flags,
                                             data + tp->args[i].offset, field))
                        goto partial;
 
-       if (!trace_seq_puts(s, "\n"))
+       if (!trace_seq_putc(s, '\n'))
                goto partial;
 
        return TRACE_TYPE_HANDLED;
@@ -1072,7 +1072,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags,
        if (!seq_print_ip_sym(s, field->func, flags & ~TRACE_ITER_SYM_OFFSET))
                goto partial;
 
-       if (!trace_seq_puts(s, ")"))
+       if (!trace_seq_putc(s, ')'))
                goto partial;
 
        data = (u8 *)&field[1];
@@ -1081,7 +1081,7 @@ print_kretprobe_event(struct trace_iterator *iter, int flags,
                                             data + tp->args[i].offset, field))
                        goto partial;
 
-       if (!trace_seq_puts(s, "\n"))
+       if (!trace_seq_putc(s, '\n'))
                goto partial;
 
        return TRACE_TYPE_HANDLED;
index 2900817ba65c7187c34394814dbeed33c6b07c7a..c4e70b6bd7faa2021deae0fa7cbb5894d00b6d34 100644 (file)
@@ -305,7 +305,7 @@ static int t_show(struct seq_file *m, void *v)
                        seq_puts(m, "\\t");
                        break;
                case '\\':
-                       seq_puts(m, "\\");
+                       seq_putc(m, '\\');
                        break;
                case '"':
                        seq_puts(m, "\\\"");
index d22117beedd00ec82256e2f61728565f6058d6d1..e35327c787f756b6d649f9d7a068951ded0778e8 100644 (file)
@@ -872,7 +872,7 @@ print_uprobe_event(struct trace_iterator *iter, int flags, struct trace_event *e
                        goto partial;
        }
 
-       if (trace_seq_puts(s, "\n"))
+       if (trace_seq_putc(s, '\n'))
                return TRACE_TYPE_HANDLED;
 
 partial: