Skip to content

Commit 146c344

Browse files
zhangwei(Jovi)rostedt
authored andcommitted
tracing: Use trace_seq_puts()/trace_seq_putc() where possible
For string without format specifiers, use trace_seq_puts() or trace_seq_putc(). Link: http://lkml.kernel.org/r/51E3B3AC.1000605@huawei.com Signed-off-by: zhangwei(Jovi) <jovi.zhangwei@huawei.com> [ fixed a trace_seq_putc(s, " ") to trace_seq_putc(s, ' ') ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
1 parent 991821c commit 146c344

6 files changed

Lines changed: 45 additions & 45 deletions

File tree

‎kernel/trace/ring_buffer.c‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ int ring_buffer_print_entry_header(struct trace_seq *s)
3636
{
3737
int ret;
3838

39-
ret = trace_seq_printf(s, "# compressed entry header\n");
40-
ret = trace_seq_printf(s, "\ttype_len : 5 bits\n");
41-
ret = trace_seq_printf(s, "\ttime_delta : 27 bits\n");
42-
ret = trace_seq_printf(s, "\tarray : 32 bits\n");
43-
ret = trace_seq_printf(s, "\n");
39+
ret = trace_seq_puts(s, "# compressed entry header\n");
40+
ret = trace_seq_puts(s, "\ttype_len : 5 bits\n");
41+
ret = trace_seq_puts(s, "\ttime_delta : 27 bits\n");
42+
ret = trace_seq_puts(s, "\tarray : 32 bits\n");
43+
ret = trace_seq_putc(s, '\n');
4444
ret = trace_seq_printf(s, "\tpadding : type == %d\n",
4545
RINGBUF_TYPE_PADDING);
4646
ret = trace_seq_printf(s, "\ttime_extend : type == %d\n",

‎kernel/trace/trace_events_filter.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ void print_event_filter(struct ftrace_event_call *call, struct trace_seq *s)
646646
if (filter && filter->filter_string)
647647
trace_seq_printf(s, "%s\n", filter->filter_string);
648648
else
649-
trace_seq_printf(s, "none\n");
649+
trace_seq_puts(s, "none\n");
650650
mutex_unlock(&event_mutex);
651651
}
652652

@@ -660,7 +660,7 @@ void print_subsystem_event_filter(struct event_subsystem *system,
660660
if (filter && filter->filter_string)
661661
trace_seq_printf(s, "%s\n", filter->filter_string);
662662
else
663-
trace_seq_printf(s, DEFAULT_SYS_FILTER_MESSAGE "\n");
663+
trace_seq_puts(s, DEFAULT_SYS_FILTER_MESSAGE "\n");
664664
mutex_unlock(&event_mutex);
665665
}
666666

‎kernel/trace/trace_functions_graph.c‎

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
446446

447447
/* First spaces to align center */
448448
for (i = 0; i < spaces / 2; i++) {
449-
ret = trace_seq_printf(s, " ");
449+
ret = trace_seq_putc(s, ' ');
450450
if (!ret)
451451
return TRACE_TYPE_PARTIAL_LINE;
452452
}
@@ -457,7 +457,7 @@ print_graph_proc(struct trace_seq *s, pid_t pid)
457457

458458
/* Last spaces to align center */
459459
for (i = 0; i < spaces - (spaces / 2); i++) {
460-
ret = trace_seq_printf(s, " ");
460+
ret = trace_seq_putc(s, ' ');
461461
if (!ret)
462462
return TRACE_TYPE_PARTIAL_LINE;
463463
}
@@ -503,7 +503,7 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data)
503503
------------------------------------------
504504
505505
*/
506-
ret = trace_seq_printf(s,
506+
ret = trace_seq_puts(s,
507507
" ------------------------------------------\n");
508508
if (!ret)
509509
return TRACE_TYPE_PARTIAL_LINE;
@@ -516,15 +516,15 @@ verif_pid(struct trace_seq *s, pid_t pid, int cpu, struct fgraph_data *data)
516516
if (ret == TRACE_TYPE_PARTIAL_LINE)
517517
return TRACE_TYPE_PARTIAL_LINE;
518518

519-
ret = trace_seq_printf(s, " => ");
519+
ret = trace_seq_puts(s, " => ");
520520
if (!ret)
521521
return TRACE_TYPE_PARTIAL_LINE;
522522

523523
ret = print_graph_proc(s, pid);
524524
if (ret == TRACE_TYPE_PARTIAL_LINE)
525525
return TRACE_TYPE_PARTIAL_LINE;
526526

527-
ret = trace_seq_printf(s,
527+
ret = trace_seq_puts(s,
528528
"\n ------------------------------------------\n\n");
529529
if (!ret)
530530
return TRACE_TYPE_PARTIAL_LINE;
@@ -645,7 +645,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
645645
ret = print_graph_proc(s, pid);
646646
if (ret == TRACE_TYPE_PARTIAL_LINE)
647647
return TRACE_TYPE_PARTIAL_LINE;
648-
ret = trace_seq_printf(s, " | ");
648+
ret = trace_seq_puts(s, " | ");
649649
if (!ret)
650650
return TRACE_TYPE_PARTIAL_LINE;
651651
}
@@ -657,9 +657,9 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
657657
return ret;
658658

659659
if (type == TRACE_GRAPH_ENT)
660-
ret = trace_seq_printf(s, "==========>");
660+
ret = trace_seq_puts(s, "==========>");
661661
else
662-
ret = trace_seq_printf(s, "<==========");
662+
ret = trace_seq_puts(s, "<==========");
663663

664664
if (!ret)
665665
return TRACE_TYPE_PARTIAL_LINE;
@@ -668,7 +668,7 @@ print_graph_irq(struct trace_iterator *iter, unsigned long addr,
668668
if (ret != TRACE_TYPE_HANDLED)
669669
return ret;
670670

671-
ret = trace_seq_printf(s, "\n");
671+
ret = trace_seq_putc(s, '\n');
672672

673673
if (!ret)
674674
return TRACE_TYPE_PARTIAL_LINE;
@@ -705,13 +705,13 @@ trace_print_graph_duration(unsigned long long duration, struct trace_seq *s)
705705
len += strlen(nsecs_str);
706706
}
707707

708-
ret = trace_seq_printf(s, " us ");
708+
ret = trace_seq_puts(s, " us ");
709709
if (!ret)
710710
return TRACE_TYPE_PARTIAL_LINE;
711711

712712
/* Print remaining spaces to fit the row's width */
713713
for (i = len; i < 7; i++) {
714-
ret = trace_seq_printf(s, " ");
714+
ret = trace_seq_putc(s, ' ');
715715
if (!ret)
716716
return TRACE_TYPE_PARTIAL_LINE;
717717
}
@@ -731,24 +731,24 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s,
731731
/* No real adata, just filling the column with spaces */
732732
switch (duration) {
733733
case DURATION_FILL_FULL:
734-
ret = trace_seq_printf(s, " | ");
734+
ret = trace_seq_puts(s, " | ");
735735
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
736736
case DURATION_FILL_START:
737-
ret = trace_seq_printf(s, " ");
737+
ret = trace_seq_puts(s, " ");
738738
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
739739
case DURATION_FILL_END:
740-
ret = trace_seq_printf(s, " |");
740+
ret = trace_seq_puts(s, " |");
741741
return ret ? TRACE_TYPE_HANDLED : TRACE_TYPE_PARTIAL_LINE;
742742
}
743743

744744
/* Signal a overhead of time execution to the output */
745745
if (flags & TRACE_GRAPH_PRINT_OVERHEAD) {
746746
/* Duration exceeded 100 msecs */
747747
if (duration > 100000ULL)
748-
ret = trace_seq_printf(s, "! ");
748+
ret = trace_seq_puts(s, "! ");
749749
/* Duration exceeded 10 msecs */
750750
else if (duration > 10000ULL)
751-
ret = trace_seq_printf(s, "+ ");
751+
ret = trace_seq_puts(s, "+ ");
752752
}
753753

754754
/*
@@ -757,7 +757,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s,
757757
* to fill out the space.
758758
*/
759759
if (ret == -1)
760-
ret = trace_seq_printf(s, " ");
760+
ret = trace_seq_puts(s, " ");
761761

762762
/* Catching here any failure happenned above */
763763
if (!ret)
@@ -767,7 +767,7 @@ print_graph_duration(unsigned long long duration, struct trace_seq *s,
767767
if (ret != TRACE_TYPE_HANDLED)
768768
return ret;
769769

770-
ret = trace_seq_printf(s, "| ");
770+
ret = trace_seq_puts(s, "| ");
771771
if (!ret)
772772
return TRACE_TYPE_PARTIAL_LINE;
773773

@@ -817,7 +817,7 @@ print_graph_entry_leaf(struct trace_iterator *iter,
817817

818818
/* Function */
819819
for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
820-
ret = trace_seq_printf(s, " ");
820+
ret = trace_seq_putc(s, ' ');
821821
if (!ret)
822822
return TRACE_TYPE_PARTIAL_LINE;
823823
}
@@ -858,7 +858,7 @@ print_graph_entry_nested(struct trace_iterator *iter,
858858

859859
/* Function */
860860
for (i = 0; i < call->depth * TRACE_GRAPH_INDENT; i++) {
861-
ret = trace_seq_printf(s, " ");
861+
ret = trace_seq_putc(s, ' ');
862862
if (!ret)
863863
return TRACE_TYPE_PARTIAL_LINE;
864864
}
@@ -917,7 +917,7 @@ print_graph_prologue(struct trace_iterator *iter, struct trace_seq *s,
917917
if (ret == TRACE_TYPE_PARTIAL_LINE)
918918
return TRACE_TYPE_PARTIAL_LINE;
919919

920-
ret = trace_seq_printf(s, " | ");
920+
ret = trace_seq_puts(s, " | ");
921921
if (!ret)
922922
return TRACE_TYPE_PARTIAL_LINE;
923923
}
@@ -1117,7 +1117,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
11171117

11181118
/* Closing brace */
11191119
for (i = 0; i < trace->depth * TRACE_GRAPH_INDENT; i++) {
1120-
ret = trace_seq_printf(s, " ");
1120+
ret = trace_seq_putc(s, ' ');
11211121
if (!ret)
11221122
return TRACE_TYPE_PARTIAL_LINE;
11231123
}
@@ -1129,7 +1129,7 @@ print_graph_return(struct ftrace_graph_ret *trace, struct trace_seq *s,
11291129
* belongs to, write out the function name.
11301130
*/
11311131
if (func_match) {
1132-
ret = trace_seq_printf(s, "}\n");
1132+
ret = trace_seq_puts(s, "}\n");
11331133
if (!ret)
11341134
return TRACE_TYPE_PARTIAL_LINE;
11351135
} else {
@@ -1179,13 +1179,13 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
11791179
/* Indentation */
11801180
if (depth > 0)
11811181
for (i = 0; i < (depth + 1) * TRACE_GRAPH_INDENT; i++) {
1182-
ret = trace_seq_printf(s, " ");
1182+
ret = trace_seq_putc(s, ' ');
11831183
if (!ret)
11841184
return TRACE_TYPE_PARTIAL_LINE;
11851185
}
11861186

11871187
/* The comment */
1188-
ret = trace_seq_printf(s, "/* ");
1188+
ret = trace_seq_puts(s, "/* ");
11891189
if (!ret)
11901190
return TRACE_TYPE_PARTIAL_LINE;
11911191

@@ -1216,7 +1216,7 @@ print_graph_comment(struct trace_seq *s, struct trace_entry *ent,
12161216
s->len--;
12171217
}
12181218

1219-
ret = trace_seq_printf(s, " */\n");
1219+
ret = trace_seq_puts(s, " */\n");
12201220
if (!ret)
12211221
return TRACE_TYPE_PARTIAL_LINE;
12221222

‎kernel/trace/trace_mmiotrace.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int mmio_print_pcidev(struct trace_seq *s, const struct pci_dev *dev)
9090
if (drv)
9191
ret += trace_seq_printf(s, " %s\n", drv->name);
9292
else
93-
ret += trace_seq_printf(s, " \n");
93+
ret += trace_seq_puts(s, " \n");
9494
return ret;
9595
}
9696

@@ -107,7 +107,7 @@ static void mmio_pipe_open(struct trace_iterator *iter)
107107
struct header_iter *hiter;
108108
struct trace_seq *s = &iter->seq;
109109

110-
trace_seq_printf(s, "VERSION 20070824\n");
110+
trace_seq_puts(s, "VERSION 20070824\n");
111111

112112
hiter = kzalloc(sizeof(*hiter), GFP_KERNEL);
113113
if (!hiter)
@@ -209,7 +209,7 @@ static enum print_line_t mmio_print_rw(struct trace_iterator *iter)
209209
(rw->value >> 0) & 0xff, rw->pc, 0);
210210
break;
211211
default:
212-
ret = trace_seq_printf(s, "rw what?\n");
212+
ret = trace_seq_puts(s, "rw what?\n");
213213
break;
214214
}
215215
if (ret)
@@ -245,7 +245,7 @@ static enum print_line_t mmio_print_map(struct trace_iterator *iter)
245245
secs, usec_rem, m->map_id, 0UL, 0);
246246
break;
247247
default:
248-
ret = trace_seq_printf(s, "map what?\n");
248+
ret = trace_seq_puts(s, "map what?\n");
249249
break;
250250
}
251251
if (ret)

‎kernel/trace/trace_output.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ enum print_line_t trace_print_printk_msg_only(struct trace_iterator *iter)
7878

7979
trace_assign_type(field, entry);
8080

81-
ret = trace_seq_printf(s, "%s", field->buf);
81+
ret = trace_seq_puts(s, field->buf);
8282
if (!ret)
8383
return TRACE_TYPE_PARTIAL_LINE;
8484

@@ -558,14 +558,14 @@ seq_print_userip_objs(const struct userstack_entry *entry, struct trace_seq *s,
558558
if (ret)
559559
ret = trace_seq_puts(s, "??");
560560
if (ret)
561-
ret = trace_seq_puts(s, "\n");
561+
ret = trace_seq_putc(s, '\n');
562562
continue;
563563
}
564564
if (!ret)
565565
break;
566566
if (ret)
567567
ret = seq_print_user_ip(s, mm, ip, sym_flags);
568-
ret = trace_seq_puts(s, "\n");
568+
ret = trace_seq_putc(s, '\n');
569569
}
570570

571571
if (mm)
@@ -579,7 +579,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags)
579579
int ret;
580580

581581
if (!ip)
582-
return trace_seq_printf(s, "0");
582+
return trace_seq_putc(s, '0');
583583

584584
if (sym_flags & TRACE_ITER_SYM_OFFSET)
585585
ret = seq_print_sym_offset(s, "%s", ip);
@@ -964,14 +964,14 @@ static enum print_line_t trace_fn_trace(struct trace_iterator *iter, int flags,
964964
goto partial;
965965

966966
if ((flags & TRACE_ITER_PRINT_PARENT) && field->parent_ip) {
967-
if (!trace_seq_printf(s, " <-"))
967+
if (!trace_seq_puts(s, " <-"))
968968
goto partial;
969969
if (!seq_print_ip_sym(s,
970970
field->parent_ip,
971971
flags))
972972
goto partial;
973973
}
974-
if (!trace_seq_printf(s, "\n"))
974+
if (!trace_seq_putc(s, '\n'))
975975
goto partial;
976976

977977
return TRACE_TYPE_HANDLED;
@@ -1210,7 +1210,7 @@ static enum print_line_t trace_stack_print(struct trace_iterator *iter,
12101210

12111211
if (!seq_print_ip_sym(s, *p, flags))
12121212
goto partial;
1213-
if (!trace_seq_puts(s, "\n"))
1213+
if (!trace_seq_putc(s, '\n'))
12141214
goto partial;
12151215
}
12161216

‎kernel/trace/trace_syscalls.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ print_syscall_exit(struct trace_iterator *iter, int flags,
175175
entry = syscall_nr_to_meta(syscall);
176176

177177
if (!entry) {
178-
trace_seq_printf(s, "\n");
178+
trace_seq_putc(s, '\n');
179179
return TRACE_TYPE_HANDLED;
180180
}
181181

0 commit comments

Comments
 (0)