MIPS: kernel: proc: Use str_yes_no() helper function
PATCH 1/1 MIPS: kernel: proc: Use str_yes_no() helper function
Remove hard-coded strings by using the str_yes_no() helper function.
--- arch/mips/kernel/proc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/mips/kernel/proc.c +4 -4
@@ -66,12 +66,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_printf (m,"BogoMIPS\t\t: %u.%02u\n" , cpu_data[n].udelay_val / (500000 /HZ ), (cpu_data[n].udelay_val / (5000 /HZ )) %100 ); -seq_printf (m,"wait instruction\t: %s\n" , cpu_wait ?"yes" :"no" ); +seq_printf (m,"wait instruction\t: %s\n" ,str_yes_no (cpu_wait));seq_printf (m,"microsecond timers\t: %s\n" , - cpu_has_counter ?"yes" :"no" ); +str_yes_no (cpu_has_counter));seq_printf (m,"tlb_entries\t\t: %d\n" , cpu_data[n].tlbsize);seq_printf (m,"extra interrupt vector\t: %s\n" , - cpu_has_divec ?"yes" :"no" ); +str_yes_no (cpu_has_divec));seq_printf (m,"hardware watchpoint\t: %s" , cpu_has_watch ?"yes, " :"no\n" );if (cpu_has_watch) {
@@ -155,7 +155,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)if (cpu_has_mmips) {seq_printf (m,"micromips kernel\t: %s\n" , - (read_c0_config3 () &MIPS_CONF3_ISA_OE ) ?"yes" :"no" ); +str_yes_no (read_c0_config3 () &MIPS_CONF3_ISA_OE )); }seq_puts (m,"Options implemented\t:" );
Signature · 1 line
2.47.0
Quoted 10 lines · Thorsten Blum
arch/mips/kernel/proc.c +1
-1@@ -66,12 +66,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_printf (m,"BogoMIPS\t\t: %u.%02u\n" , cpu_data[n].udelay_val / (500000 /HZ ), (cpu_data[n].udelay_val / (5000 /HZ )) %100 ); -seq_printf (m,"wait instruction\t: %s\n" , cpu_wait ?"yes" :"no" ); +seq_printf (m,"wait instruction\t: %s\n" ,str_yes_no (cpu_wait));
arch/mips/kernel/proc.c static int show_cpuinfo(struct seq_file *m, void *v) · line 77
Quoted 10 lines
arch/mips/kernel/proc.c +2
-2seq_printf (m,"microsecond timers\t: %s\n" , - cpu_has_counter ?"yes" :"no" ); +str_yes_no (cpu_has_counter));seq_printf (m,"tlb_entries\t\t: %d\n" , cpu_data[n].tlbsize);seq_printf (m,"extra interrupt vector\t: %s\n" , - cpu_has_divec ?"yes" :"no" ); +str_yes_no (cpu_has_divec));seq_printf (m,"hardware watchpoint\t: %s" , cpu_has_watch ?"yes, " :"no\n" );if (cpu_has_watch) {
I like this cleanup, but now that it matters I suggest restructuring code
such that the latter `seq_printf' is converted as well.
NB I think there is no need to split the patch into two for such a minor
change, even though technically these would be two independent updates.
Maciej
Quoted 17 lines · Maciej W. Rozycki
Quoted 15 lines · Thorsten Blum
arch/mips/kernel/proc.c +2
-2@@ -66,12 +66,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_printf (m,"BogoMIPS\t\t: %u.%02u\n" , cpu_data[n].udelay_val / (500000 /HZ ), (cpu_data[n].udelay_val / (5000 /HZ )) %100 ); -seq_printf (m,"wait instruction\t: %s\n" , cpu_wait ?"yes" :"no" ); +seq_printf (m,"wait instruction\t: %s\n" ,str_yes_no (cpu_wait));seq_printf (m,"microsecond timers\t: %s\n" , - cpu_has_counter ?"yes" :"no" ); +str_yes_no (cpu_has_counter));seq_printf (m,"tlb_entries\t\t: %d\n" , cpu_data[n].tlbsize); seq_printf(m, "extra interrupt vector\t: %s\n",
Quoted 8 lines
arch/mips/kernel/proc.c static int show_cpuinfo(struct seq_file *m, void *v) · line 77
Quoted 5 lines
arch/mips/kernel/proc.c +1
-1- cpu_has_divec ? "yes" : "no"); + str_yes_no(cpu_has_divec));seq_printf (m,"hardware watchpoint\t: %s" , cpu_has_watch ?"yes, " :"no\n" );if (cpu_has_watch) {I like this cleanup, but now that it matters I suggest restructuring code such that the latter `seq_printf' is converted as well.
What about the comma and newline? Using str_yes_no() would remove them.
Thanks,
Thorsten
Quoted 4 lines · Thorsten Blum
Quoted 2 lines
I like this cleanup, but now that it matters I suggest restructuring code such that the latter `seq_printf' is converted as well.
What about the comma and newline? Using
str_yes_no()would remove them.
This is why a minor code restructuring is needed so that the comma and
the new line are produced elsewhere (arguably a cleaner structure anyway).
Maciej
Quoted 6 lines · Maciej W. Rozycki
Quoted 2 lines · Thorsten Blum
What about the comma and newline? Using
str_yes_no()would remove them.This is why a minor code restructuring is needed so that the comma and the new line are produced elsewhere (arguably a cleaner structure anyway).
Ok, I'll submit a v2.
Thanks,
Thorsten