diff mbox series

[1/2] x86: apm: mark proc_apm_show as __maybe_unused

Message ID 20180814091904.2186262-1-arnd@arndb.de
State New
Headers show
Series [1/2] x86: apm: mark proc_apm_show as __maybe_unused | expand

Commit Message

Arnd Bergmann Aug. 14, 2018, 9:18 a.m. UTC
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}")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 arch/x86/kernel/apm_32.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.18.0

Comments

Christoph Hellwig Aug. 17, 2018, 6:43 a.m. UTC | #1
On Tue, Aug 14, 2018 at 11:18:45AM +0200, Arnd Bergmann wrote:
> 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}")

> Signed-off-by: Arnd Bergmann <arnd@arndb.de>


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.
Thomas Gleixner Aug. 20, 2018, 3:40 p.m. UTC | #2
On Tue, 14 Aug 2018, Arnd Bergmann wrote:

> 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
Arnd Bergmann Aug. 20, 2018, 4:11 p.m. UTC | #3
On Mon, Aug 20, 2018 at 5:40 PM Thomas Gleixner <tglx@linutronix.de> wrote:
>

> On Tue, 14 Aug 2018, Arnd Bergmann wrote:

>

> > 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 ....


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
diff mbox series

Patch

diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index ec00d1ff5098..79b5ed518471 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -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;