Skip to contentSkip to conversation

proc: centralise declaration of cpuinfo_op

PATCH In review Ben Dooks 2 participants 3 messages Oct 9, 2019 – Oct 11, 2019

Subsystems (5)
lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 proc: centralise declaration of cpuinfo_op

When building for arm, cpuinfo_op generates a warning due to no declaration. Since this is used in fs/proc/cpuinfo.c and inconsitently declared across archiectures move the declaration info <linux/seq_file.h>. This means that the cpuinfo_op will have a declaration any place it is used.

Removes the following sparse warning:

arch/arm/kernel/setup.c:1320:29: warning: symbol 'cpuinfo_op' was not declared. Should it be static?

---
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Mark Salter <[email protected]>
Cc: Aurelien Jacquiot <[email protected]>
Cc: Heiko Carstens <[email protected]>
Cc: Yoshinori Sato <[email protected]>
Cc: Rich Felker <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: "H. Peter Anvin" <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]

---
 arch/c6x/include/asm/processor.h        | 2 --
 arch/microblaze/include/asm/processor.h | 3 ---
 arch/s390/include/asm/processor.h       | 1 -
 arch/sh/include/asm/processor.h         | 1 -
 arch/sparc/include/asm/cpudata.h        | 2 --
 arch/x86/include/asm/processor.h        | 2 --
 include/linux/seq_file.h                | 2 ++
 7 files changed, 2 insertions(+), 11 deletions(-)
arch/c6x/include/asm/processor.h +0 -2
index 1456f5e11de3..ecc906854b6a 100644
@@ -100,8 +100,6 @@ extern unsigned long get_wchan(struct task_struct *p);
 
 #define cpu_relax()		do { } while (0)
 
-extern const struct seq_operations cpuinfo_op;
-
 /* Reset the board */
 #define HARD_RESET_NOW()
 
arch/microblaze/include/asm/processor.h +0 -3
index 66b537b8d138..8ab09e94b8ae 100644
@@ -18,9 +18,6 @@
 #include <asm/current.h>
 
 # ifndef __ASSEMBLY__
-/* from kernel/cpu/mb.c */
-extern const struct seq_operations cpuinfo_op;
-
 # define cpu_relax()		barrier()
 
 #define task_pt_regs(tsk) \
arch/s390/include/asm/processor.h +0 -1
index 51a0e4a2dc96..813d2bfc63ac 100644
@@ -83,7 +83,6 @@ void s390_adjust_jiffies(void);
 void s390_update_cpu_mhz(void);
 void cpu_detect_mhz_feature(void);
 
-extern const struct seq_operations cpuinfo_op;
 extern int sysctl_ieee_emulation_warnings;
 extern void execve_tail(void);
 extern void __bpon(void);
arch/sh/include/asm/processor.h +0 -1
index 6fbf8c80e498..25ddb34f31d9 100644
@@ -128,7 +128,6 @@ extern unsigned int mem_init_done;
 
 /* arch/sh/kernel/setup.c */
 const char *get_cpu_subtype(struct sh_cpuinfo *c);
-extern const struct seq_operations cpuinfo_op;
 
 /* thread_struct flags */
 #define SH_THREAD_UAC_NOPRINT	(1 << 0)
arch/sparc/include/asm/cpudata.h +0 -2
index d213165ee713..f7e690a7860b 100644
@@ -7,8 +7,6 @@
 #include <linux/threads.h>
 #include <linux/percpu.h>
 
-extern const struct seq_operations cpuinfo_op;
-
 #endif /* !(__ASSEMBLY__) */
 
 #if defined(__sparc__) && defined(__arch64__)
arch/x86/include/asm/processor.h +0 -2
index 6e0a3b43d027..6f22daf892ea 100644
@@ -169,8 +169,6 @@ DECLARE_PER_CPU_READ_MOSTLY(struct cpuinfo_x86, cpu_info);
 #define cpu_data(cpu)		boot_cpu_data
 #endif
 
-extern const struct seq_operations cpuinfo_op;
-
 #define cache_line_size()	(boot_cpu_data.x86_cache_alignment)
 
 extern void cpu_detect(struct cpuinfo_x86 *c);
include/linux/seq_file.h +2 -0
index 5998e1f4ff06..629b0d8302e8 100644
@@ -36,6 +36,8 @@ struct seq_operations {
 	int (*show) (struct seq_file *m, void *v);
 };
 
+extern const struct seq_operations cpuinfo_op;
+
 #define SEQ_SKIP 1
 
 /**
Signature · 1 line
2.23.0
#1 lore raw
Quoted 9 lines · Ben Dooks

When building for arm, cpuinfo_op generates a warning due to no declaration. Since this is used in fs/proc/cpuinfo.c and inconsitently declared across archiectures move the declaration info <linux/seq_file.h>. This means that the cpuinfo_op will have a declaration any place it is used.

Removes the following sparse warning:

arch/arm/kernel/setup.c:1320:29: warning: symbol 'cpuinfo_op' was not declared. Should it be static?

I like the consolidation, but I don't think seq_file.h is the right place. A procfs or cpu topology related header seems like the better choice.

author
#2 lore raw
Quoted 7 lines · Christoph Hellwig
Quoted 6 lines · Ben Dooks

When building for arm, cpuinfo_op generates a warning due to no declaration. Since this is used in fs/proc/cpuinfo.c and inconsitently declared across archiectures move the declaration info <linux/seq_file.h>. This means that the cpuinfo_op will have a declaration any place it is used.

Quoted 7 lines
Quoted 3 lines

Removes the following sparse warning:

arch/arm/kernel/setup.c:1320:29: warning: symbol 'cpuinfo_op' was not declared. Should it be static?

I like the consolidation, but I don't think seq_file.h is the right place. A procfs or cpu topology related header seems like the better choice.

Ok, thanks.

I'll have a look at where else it could go, but I'm not sure if I have the resources to build /all/ kernels that this would effect.

Signature · 4 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html