* [PATCH] MIPS: kernel: proc: Use str_yes_no() helper function
@ 2024-11-02 22:04 Thorsten Blum
2024-11-03 19:29 ` Maciej W. Rozycki
0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2024-11-02 22:04 UTC (permalink / raw)
To: Thomas Bogendoerfer; +Cc: Thorsten Blum, linux-mips, linux-kernel
Remove hard-coded strings by using the str_yes_no() helper function.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
arch/mips/kernel/proc.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
index 8eba5a1ed664..3e4be48bab02 100644
--- a/arch/mips/kernel/proc.c
+++ b/arch/mips/kernel/proc.c
@@ -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:");
--
2.47.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] MIPS: kernel: proc: Use str_yes_no() helper function
2024-11-02 22:04 [PATCH] MIPS: kernel: proc: Use str_yes_no() helper function Thorsten Blum
@ 2024-11-03 19:29 ` Maciej W. Rozycki
2024-11-04 23:45 ` Thorsten Blum
0 siblings, 1 reply; 5+ messages in thread
From: Maciej W. Rozycki @ 2024-11-03 19:29 UTC (permalink / raw)
To: Thorsten Blum; +Cc: Thomas Bogendoerfer, linux-mips, linux-kernel
On Sat, 2 Nov 2024, Thorsten Blum wrote:
> diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
> index 8eba5a1ed664..3e4be48bab02 100644
> --- a/arch/mips/kernel/proc.c
> +++ b/arch/mips/kernel/proc.c
> @@ -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) {
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MIPS: kernel: proc: Use str_yes_no() helper function
2024-11-03 19:29 ` Maciej W. Rozycki
@ 2024-11-04 23:45 ` Thorsten Blum
2024-11-04 23:51 ` Maciej W. Rozycki
0 siblings, 1 reply; 5+ messages in thread
From: Thorsten Blum @ 2024-11-04 23:45 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: Thomas Bogendoerfer, linux-mips, linux-kernel
On 3. Nov 2024, at 20:29, Maciej W. Rozycki wrote:
> On Sat, 2 Nov 2024, Thorsten Blum wrote:
>
>> diff --git a/arch/mips/kernel/proc.c b/arch/mips/kernel/proc.c
>> index 8eba5a1ed664..3e4be48bab02 100644
>> --- a/arch/mips/kernel/proc.c
>> +++ b/arch/mips/kernel/proc.c
>> @@ -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) {
>
> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MIPS: kernel: proc: Use str_yes_no() helper function
2024-11-04 23:45 ` Thorsten Blum
@ 2024-11-04 23:51 ` Maciej W. Rozycki
2024-11-05 0:40 ` Thorsten Blum
0 siblings, 1 reply; 5+ messages in thread
From: Maciej W. Rozycki @ 2024-11-04 23:51 UTC (permalink / raw)
To: Thorsten Blum; +Cc: Thomas Bogendoerfer, linux-mips, linux-kernel
On Tue, 5 Nov 2024, Thorsten Blum wrote:
> > 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] MIPS: kernel: proc: Use str_yes_no() helper function
2024-11-04 23:51 ` Maciej W. Rozycki
@ 2024-11-05 0:40 ` Thorsten Blum
0 siblings, 0 replies; 5+ messages in thread
From: Thorsten Blum @ 2024-11-05 0:40 UTC (permalink / raw)
To: Maciej W. Rozycki; +Cc: Thomas Bogendoerfer, linux-mips, linux-kernel
On 5. Nov 2024, at 00:51, Maciej W. Rozycki wrote:
> On Tue, 5 Nov 2024, Thorsten Blum wrote:
>>
>> 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
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-11-05 0:51 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-02 22:04 [PATCH] MIPS: kernel: proc: Use str_yes_no() helper function Thorsten Blum
2024-11-03 19:29 ` Maciej W. Rozycki
2024-11-04 23:45 ` Thorsten Blum
2024-11-04 23:51 ` Maciej W. Rozycki
2024-11-05 0:40 ` Thorsten Blum
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).