Skip to content

Commit

Permalink
powerpc/setup: Adjust six seq_printf() calls in show_cpuinfo()
Browse files Browse the repository at this point in the history
A bit of information should be put into a sequence.
Thus improve the execution speed for this data output by better usage
of corresponding functions.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/5b62379e-a35f-4f56-f1b5-6350f76007e7@web.de
  • Loading branch information
Markus Elfring authored and Michael Ellerman committed Jan 31, 2021
1 parent c0cff7a commit 675b963
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions arch/powerpc/kernel/setup-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,18 +238,17 @@ static int show_cpuinfo(struct seq_file *m, void *v)
maj = (pvr >> 8) & 0xFF;
min = pvr & 0xFF;

seq_printf(m, "processor\t: %lu\n", cpu_id);
seq_printf(m, "cpu\t\t: ");
seq_printf(m, "processor\t: %lu\ncpu\t\t: ", cpu_id);

if (cur_cpu_spec->pvr_mask && cur_cpu_spec->cpu_name)
seq_printf(m, "%s", cur_cpu_spec->cpu_name);
seq_puts(m, cur_cpu_spec->cpu_name);
else
seq_printf(m, "unknown (%08x)", pvr);

if (cpu_has_feature(CPU_FTR_ALTIVEC))
seq_printf(m, ", altivec supported");
seq_puts(m, ", altivec supported");

seq_printf(m, "\n");
seq_putc(m, '\n');

#ifdef CONFIG_TAU
if (cpu_has_feature(CPU_FTR_TAU)) {
Expand Down Expand Up @@ -328,7 +327,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
seq_printf(m, "bogomips\t: %lu.%02lu\n", loops_per_jiffy / (500000 / HZ),
(loops_per_jiffy / (5000 / HZ)) % 100);

seq_printf(m, "\n");
seq_putc(m, '\n');

/* If this is the last cpu, print the summary */
if (cpumask_next(cpu_id, cpu_online_mask) >= nr_cpu_ids)
Expand Down

0 comments on commit 675b963

Please sign in to comment.