Skip to contentSkip to conversation

x86: apm: mark proc_apm_show as __maybe_unused

PATCH In review Arnd Bergmann 3 participants 5 messages Aug 14, 2018 – Aug 20, 2018

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 x86: apm: mark proc_apm_show as __maybe_unused

A new build error appeared with CONFIG_PROC_FS disabled:

arch/x86/kernel/apm_32.c:1643:12: error: 'proc_apm_show' defined but not used [-Werror=unused-function]

This marks the function as __maybe_unused to let the compiler drop it silently.

Fixes 3f3942aca6da ("proc: introduce proc_create_single{,_data}")
---
 arch/x86/kernel/apm_32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kernel/apm_32.c +1 -1
index ec00d1ff5098..79b5ed518471 100644
@@ -1640,7 +1640,7 @@ static int do_open(struct inode *inode, struct file *filp)
 	return 0;
 }
 
-static int proc_apm_show(struct seq_file *m, void *v)
+static int __maybe_unused proc_apm_show(struct seq_file *m, void *v)
 {
 	unsigned short	bx;
 	unsigned short	cx;
Signature · 1 line
2.18.0
#1 lore raw

PATCH 2/2 ARM: rpc: mark ecard_devices_proc_show as __maybe_unused

A new build error appeared with CONFIG_PROC_FS disabled:

arch/arm/mach-rpc/ecard.c:646:12: error: 'ecard_devices_proc_show' defined but not used [-Werror=unused-function]

This marks the function as __maybe_unused to let the compiler drop it silently.

Fixes 3f3942aca6da ("proc: introduce proc_create_single{,_data}")
---
 arch/arm/mach-rpc/ecard.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rpc/ecard.c +1 -1
index 6fb51d49ad26..761a629f9e9d 100644
@@ -643,7 +643,7 @@ static int ecard_prints(struct seq_file *m, ecard_t *ec)
 	return 0;
 }
 
-static int ecard_devices_proc_show(struct seq_file *m, void *v)
+static int __maybe_unused ecard_devices_proc_show(struct seq_file *m, void *v)
 {
 	ecard_t *ec = cards;
 
Signature · 1 line
2.18.0
#2 lore raw
In reply to Arnd Bergmann
Quoted 9 lines · Arnd Bergmann

A new build error appeared with CONFIG_PROC_FS disabled:

arch/x86/kernel/apm_32.c:1643:12: error: 'proc_apm_show' defined but not used [-Werror=unused-function]

This marks the function as __maybe_unused to let the compiler drop it silently.

Fixes 3f3942aca6da ("proc: introduce proc_create_single{,_data}")

I have to admit I actually prefer ifdefs over magic __maybe_unused annotations. But otherwise this looks correct to me, same for the other patch.

#3 lore raw
In reply to Arnd Bergmann
Quoted 8 lines · Arnd Bergmann

A new build error appeared with CONFIG_PROC_FS disabled:

arch/x86/kernel/apm_32.c:1643:12: error: 'proc_apm_show' defined but not used [-Werror=unused-function]

This marks the function as __maybe_unused to let the compiler drop it silently.

Fixes 3f3942aca6da ("proc: introduce proc_create_single{,_data}")

The proper fix for this is to convert the stub function for proc_apm_show() to an inline. The compiler complains because the stub is a macro ....

Thanks,

tglx

#4 lore raw
Quoted 7 lines · Thomas Gleixner
Quoted 4 lines · Arnd Bergmann

A new build error appeared with CONFIG_PROC_FS disabled:

arch/x86/kernel/apm_32.c:1643:12: error: 'proc_apm_show' defined but not used [-Werror=unused-function]

Quoted 7 lines
Quoted 4 lines

This marks the function as __maybe_unused to let the compiler drop it silently.

Fixes 3f3942aca6da ("proc: introduce proc_create_single{,_data}")

The proper fix for this is to convert the stub function for proc_apm_show() to an inline. The compiler complains because the stub is a macro ....

I even did that
https://patchwork.ozlabs.org/patch/920786/

but then a handful of patches went into the kernel to add #ifdefs around the other proc_show functions, so it no longer applied. These two are the only remaining ones.

Arnd