Skip to contentSkip to conversation

arch/alpha/kernel: disable -Wmissing-prototypes for asmlinkage functions

PATCH New Max Kellermann 1 participant 11 messages Mar 11, 2024

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

PATCH 1/11 arch/alpha/kernel: disable -Wmissing-prototypes for asmlinkage functions

There are no prototypes for functions which are only called by assembly code. Tell the compiler to disable those warnings in the relevant sources, just like arch/parisc/kernel/Makefile does.

---
 arch/alpha/kernel/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)
arch/alpha/kernel/Makefile +8 -0
index fb4efec7cbc7..5ba1400f3e4c 100644
@@ -7,6 +7,14 @@ extra-y		:= vmlinux.lds
 asflags-y	:= $(KBUILD_CFLAGS)
 ccflags-y	:= -Wno-sign-compare
 
+# no prototype warnings for functions which are only called by
+# assembly code
+CFLAGS_REMOVE_irq_alpha.o = -Wmissing-prototypes -Wmissing-declarations
+CFLAGS_REMOVE_ptrace.o = -Wmissing-prototypes -Wmissing-declarations
+CFLAGS_REMOVE_signal.o = -Wmissing-prototypes -Wmissing-declarations
+CFLAGS_REMOVE_smp.o = -Wmissing-prototypes -Wmissing-declarations
+CFLAGS_REMOVE_traps.o = -Wmissing-prototypes -Wmissing-declarations
+
 obj-y    := head.o entry.o traps.o process.o osf_sys.o irq.o \
 	    irq_alpha.o signal.o setup.o ptrace.o time.o \
 	    systbls.o err_common.o io.o bugs.o termios.o
Signature · 1 line
2.39.2
#1 lore raw

PATCH 2/11 arch/alpha/bugs: add missing SPDX header

---
 arch/alpha/kernel/bugs.c | 1 +
 1 file changed, 1 insertion(+)
arch/alpha/kernel/bugs.c +1 -0
index 08cc10d7fa17..6a16559c1a8f 100644
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 
 #include <asm/hwrpb.h>
 #include <linux/device.h>
Signature · 1 line
2.39.2
#2 lore raw

PATCH 3/11 arch/alpha/bugs: include <linux/cpu.h> to fix -Wmissing-prototypes

In reply to Max Kellermann

Fixes:

arch/alpha/kernel/bugs.c:19:9: error: no previous prototype for 'cpu_show_meltdown' [-Werror=missing-prototypes]
19 | ssize_t cpu_show_meltdown(struct device *dev,
| ^~~~~~~~~~~~~~~~~
[...]

---
 arch/alpha/kernel/bugs.c | 1 +
 1 file changed, 1 insertion(+)
arch/alpha/kernel/bugs.c +1 -0
index 6a16559c1a8f..d6ee9a30698d 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 
+#include <linux/cpu.h> // prototypes for functions defined here
 #include <asm/hwrpb.h>
 #include <linux/device.h>
 
Signature · 1 line
2.39.2
#3 lore raw

PATCH 4/11 arch/alpha/io: add missing includes to fix -Wmissing-prototypes

In reply to Max Kellermann

Fixes:

arch/alpha/kernel/io.c:654:1: error: no previous prototype for 'scr_memcpyw' [-Werror=missing-prototypes]
654 | scr_memcpyw(u16 *d, const u16 *s, unsigned int count)

       | ^~~~~~~~~~~
---
 arch/alpha/kernel/io.c | 1 +
 1 file changed, 1 insertion(+)
arch/alpha/kernel/io.c +1 -0
index eda09778268f..fc5f7b80c7ea 100644
@@ -8,6 +8,7 @@
 #include <linux/string.h>
 #include <linux/module.h>
 #include <asm/io.h>
+#include <asm/vga.h> // for the scr_memcpyw() prototype
 
 /* Out-of-line versions of the i/o routines that redirect into the 
    platform-specific version.  Note that "platform-specific" may mean
Signature · 1 line
2.39.2
#4 lore raw

PATCH 5/11 arch/alpha/pci: make pcibios_claim_one_bus() static

In reply to Max Kellermann

This function is only used within this source file. Fixes -Wmissing-prototypes:

arch/alpha/kernel/pci.c:285:1: error: no previous prototype for 'pcibios_claim_one_bus' [-Werror=missing-prototypes]
285 | pcibios_claim_one_bus(struct pci_bus *b)

       | ^~~~~~~~~~~~~~~~~~~~~
---
 arch/alpha/kernel/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/alpha/kernel/pci.c +1 -1
index 4458eb7f44f0..71495b1354eb 100644
@@ -281,7 +281,7 @@ pcibios_set_master(struct pci_dev *dev)
 	pci_write_config_byte(dev, PCI_LATENCY_TIMER, 64);
 }
 
-void __init
+static void __init
 pcibios_claim_one_bus(struct pci_bus *b)
 {
 	struct pci_dev *dev;
Signature · 1 line
2.39.2
#5 lore raw

PATCH 6/11 arch/alpha/irq: include irq_impl.h to fix -Wmissing-prototypes

In reply to Max Kellermann

Fixes:

arch/alpha/kernel/irq.c:96:1: error: no previous prototype for 'handle_irq' [-Werror=missing-prototypes]
96 | handle_irq(int irq)
| ^~~~~~~~~~
[...]

---
 arch/alpha/kernel/irq.c | 1 +
 1 file changed, 1 insertion(+)
arch/alpha/kernel/irq.c +1 -0
index 15f2effd6baf..51c1c87ad8c4 100644
@@ -11,6 +11,7 @@
  * should be easier.
  */
 
+#include "irq_impl.h"
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/errno.h>
Signature · 1 line
2.39.2
#6 lore raw

PATCH 7/11 arch/alpha/perf_event: make init_hw_perf_events() static

In reply to Max Kellermann

This function is only used within this source file. Fixes -Wmissing-prototypes:

arch/alpha/kernel/perf_event.c:873:12: error: no previous prototype for 'init_hw_perf_events' [-Werror=missing-prototypes]
873 | int __init init_hw_perf_events(void)

       |            ^~~~~~~~~~~~~~~~~~~
---
 arch/alpha/kernel/perf_event.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/alpha/kernel/perf_event.c +1 -1
index ccdb508c1516..1f0eb4f25c0f 100644
@@ -870,7 +870,7 @@ static void alpha_perf_event_irq_handler(unsigned long la_ptr,
 /*
  * Init call to initialise performance events at kernel startup.
  */
-int __init init_hw_perf_events(void)
+static int __init init_hw_perf_events(void)
 {
 	pr_info("Performance events: ");
 
Signature · 1 line
2.39.2
#7 lore raw

PATCH 8/11 arch/alpha/checksum: add missing includes to fix -Wmissing-prototypes

In reply to Max Kellermann

Fixes:

arch/alpha/lib/checksum.c:45:9: error: no previous prototype for 'csum_tcpudp_magic' [-Werror=missing-prototypes]

    45 | __sum16 csum_tcpudp_magic(__be32 saddr, __be32 daddr,
       |         ^~~~~~~~~~~~~~~~~
---
 arch/alpha/lib/checksum.c | 2 ++
 1 file changed, 2 insertions(+)
arch/alpha/lib/checksum.c +2 -0
index 3f35c3ed6948..66cad8354a44 100644
@@ -10,6 +10,8 @@
  *	Rick Gorton	<[email protected]>
  */
  
+#include <asm/checksum.h>
+
 #include <linux/module.h>
 #include <linux/string.h>
 
Signature · 1 line
2.39.2
#8 lore raw

PATCH 9/11 arch/alpha/fpreg: add missing includes to fix -Wmissing-prototypes

In reply to Max Kellermann

Fixes:

arch/alpha/lib/fpreg.c:20:1: error: no previous prototype for 'alpha_read_fp_reg' [-Werror=missing-prototypes]
20 | alpha_read_fp_reg (unsigned long reg)
| ^~~~~~~~~~~~~~~~~
[...]

---
 arch/alpha/lib/fpreg.c | 3 +++
 1 file changed, 3 insertions(+)
arch/alpha/lib/fpreg.c +3 -0
index 7c08b225261c..88e912689140 100644
@@ -5,9 +5,12 @@
  * (C) Copyright 1998 Linus Torvalds
  */
 
+#include "../kernel/proto.h"
+
 #include <linux/compiler.h>
 #include <linux/export.h>
 #include <linux/preempt.h>
+#include <asm/fpu.h>
 #include <asm/thread_info.h>
 
 #if defined(CONFIG_ALPHA_EV6) || defined(CONFIG_ALPHA_EV67)
Signature · 1 line
2.39.2
#9 lore raw

PATCH 10/11 arch/alpha/smc37c669.: make SMC37c669_dump_registers() static

In reply to Max Kellermann

This function is only used within this source file. Fixes -Wmissing-prototypes:

arch/alpha/kernel/smc37c669.c:2434:1: error: no previous prototype for 'SMC37c669_dump_registers' [-Werror=missing-prototypes]
2434 | SMC37c669_dump_registers(void)

       | ^~~~~~~~~~~~~~~~~~~~~~~~

Also add #if SMC_DEBUG because it's only ever used under this condition.

---
 arch/alpha/kernel/smc37c669.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
arch/alpha/kernel/smc37c669.c +4 -1
index bbbd34586de0..ab22ade3dea3 100644
@@ -2430,13 +2430,16 @@ int __init smcc669_write( struct FILE *fp, int size, int number, unsigned char *
 }
 #endif
 
-void __init
+#if SMC_DEBUG
+static void __init
 SMC37c669_dump_registers(void)
 {
   int i;
   for (i = 0; i <= 0x29; i++)
     printk("-- CR%02x : %02x\n", i, SMC37c669_read_config(i));
 }
+#endif // SMC_DEBUG
+
 /*+
  * ============================================================================
  * = SMC_init - SMC37c669 Super I/O controller initialization                 =
Signature · 1 line
2.39.2
#10 lore raw

PATCH 11/11 arch/alpha/smc37c669: add missing includes to fix -Wmissing-prototypes

In reply to Max Kellermann

Fixes:

arch/alpha/kernel/smc37c669.c:2467:13: error: no previous prototype for 'SMC669_Init' [-Werror=missing-prototypes]
2467 | void __init SMC669_Init ( int index )

       |             ^~~~~~~~~~~
---
 arch/alpha/kernel/smc37c669.c | 3 +++
 1 file changed, 3 insertions(+)
arch/alpha/kernel/smc37c669.c +3 -0
index ab22ade3dea3..be71ea825690 100644
@@ -1,6 +1,9 @@
 /*
  * SMC 37C669 initialization code
  */
+
+#include "proto.h" // for the SMC669_Init() prototype
+
 #include <linux/kernel.h>
 
 #include <linux/mm.h>
Signature · 1 line
2.39.2