LoongArch: kernel: proc: Use str_yes_no() helper function
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/3 LoongArch: kernel: proc: Use str_yes_no() helper function
Remove hard-coded strings by using the str_yes_no() helper function.
Similar to commit c4a0a4a45a45 ("MIPS: kernel: proc: Use str_yes_no() helper function").
--- arch/loongarch/kernel/proc.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
arch/loongarch/kernel/proc.c +3 -4
@@ -91,10 +91,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)if (cpu_has_lbt_mips)seq_printf (m," lbt_mips" );seq_printf (m,"\n" ); -seq_printf (m,"Hardware Watchpoint\t: %s" , - cpu_has_watch ?"yes, " :"no\n" ); +seq_printf (m,"Hardware Watchpoint\t: %s" ,str_yes_no (cpu_has_watch));if (cpu_has_watch) { -seq_printf (m,"iwatch count: %d, dwatch count: %d\n" , +seq_printf (m,", iwatch count: %d, dwatch count: %d" , cpu_data[n].watch_ireg_count, cpu_data[n].watch_dreg_count); }
@@ -104,7 +103,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)raw_notifier_call_chain (&proc_cpuinfo_chain,0 , &proc_cpuinfo_notifier_args); -seq_printf (m,"\n" ); +seq_printf (m,"\n\n" );return 0 ; }
Signature · 1 line
2.47.2
PATCH 2/3 LoongArch: Remove the deprecated notifier hook mechanism
In reply to a message not in the archiveThe notifier hook mechanism in proc and cpuinfo is actually unnecessary for LoongArch because it's not used anywhere.
It was originally added to the MIPS code in commit d6d3c9afaab4 ("MIPS:
MT: proc: Add support for printing VPE and TC ids"), and LoongArch then inherited it.
But as the kernel code stands now, this notifier hook mechanism doesn't really make sense for either LoongArch or MIPS.
--- arch/loongarch/include/asm/cpu-info.h | 19 ------------------- arch/loongarch/kernel/proc.c | 22 ---------------------- 2 files changed, 41 deletions(-)
arch/loongarch/include/asm/cpu-info.h +0 -19
@@ -77,25 +77,6 @@ extern const char *__cpu_full_name[];#define cpu_full_name_string () __cpu_full_name[raw_smp_processor_id()]struct seq_file ; -struct notifier_block ; - -extern int register_proc_cpuinfo_notifier (struct notifier_block *nb); -extern int proc_cpuinfo_notifier_call_chain (unsigned long val,void *v); - -#define proc_cpuinfo_notifier (fn, pri) \ -({ \ - static struct notifier_block fn##_nb = { \ - .notifier_call = fn, \ - .priority = pri \ - }; \ - \ - register_proc_cpuinfo_notifier(&fn##_nb); \ -}) - -struct proc_cpuinfo_notifier_args { -struct seq_file *m; -unsigned long n; -};static inline bool cpus_are_siblings (int cpua,int cpub) {
arch/loongarch/kernel/proc.c +0 -22
@@ -13,28 +13,12 @@#include <asm/processor.h> #include <asm/time.h> -/* -* No lock; only written during early bootup by CPU 0. -*/ -static RAW_NOTIFIER_HEAD (proc_cpuinfo_chain); - -int __ref register_proc_cpuinfo_notifier (struct notifier_block *nb) -{ -return raw_notifier_chain_register (&proc_cpuinfo_chain, nb); -} - -int proc_cpuinfo_notifier_call_chain (unsigned long val,void *v) -{ -return raw_notifier_call_chain (&proc_cpuinfo_chain, val, v); -} -static int show_cpuinfo (struct seq_file *m,void *v) {unsigned long n = (unsigned long ) v -1 ;unsigned int isa = cpu_data[n].isa_level;unsigned int version = cpu_data[n].processor_id &0xff ;unsigned int fp_version = cpu_data[n].fpu_vers; -struct proc_cpuinfo_notifier_args proc_cpuinfo_notifier_args;#ifdef CONFIG_SMP if (!cpu_online (n))
@@ -97,12 +81,6 @@ static int show_cpuinfo(struct seq_file *m, void *v) cpu_data[n].watch_ireg_count, cpu_data[n].watch_dreg_count); } - proc_cpuinfo_notifier_args.m = m; - proc_cpuinfo_notifier_args.n = n; - -raw_notifier_call_chain (&proc_cpuinfo_chain,0 , - &proc_cpuinfo_notifier_args); -seq_printf (m,"\n\n" );return 0 ;
Signature · 1 line
2.47.2
PATCH 3/3 LoongArch: Relocate the seq_file declaration to the correct place
In reply to a message not in the archiveThe seq_file structure only needs to be declared in a header file when CONFIG_SMP is enabled. Therefore, it clearly belongs in smp.h, which, however, does not declare it. Instead, cpuinfo.h inappropriately declares this structure, fortuitously allowing the code to function.
--- arch/loongarch/include/asm/cpu-info.h | 2 -- arch/loongarch/include/asm/smp.h | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-)
arch/loongarch/include/asm/cpu-info.h +0 -2
@@ -76,8 +76,6 @@ extern const char *__cpu_full_name[];#define cpu_family_string () __cpu_family[raw_smp_processor_id()]#define cpu_full_name_string () __cpu_full_name[raw_smp_processor_id()] -struct seq_file ; -static inline bool cpus_are_siblings (int cpua,int cpub) {struct cpuinfo_loongarch *infoa = &cpu_data[cpua];
arch/loongarch/include/asm/smp.h +2 -0
@@ -14,6 +14,8 @@#include <linux/threads.h> #include <linux/cpumask.h> +struct seq_file ; +struct smp_ops {void (*init_ipi)(void );void (*send_ipi_single)(int cpu,unsigned int action);
Signature · 1 line
2.47.2