2024-03-04 19:11:08

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 0/7] sh: Fix missing prototypes (part two)

Hi all,

This patch series fixes more "no previous prototype for <foo>" warnings
when building a kernel for SuperH, and is a follow-up to [1].

This has been boot-tested on landisk and on qemu/rts7751r2d.

Thanks for your comments!

[1] "[PATCH 00/20] sh: Fix missing prototypes"
https://lore.kernel.org/r/[email protected]>

Geert Uytterhoeven (7):
sh: cache: Move forward declarations to <asm/cacheflush.h>
sh: traps: Make is_dsp_inst() static
sh: mach-highlander: Add missing #include <mach/highlander.h>
sh: mach-sh03: Make sh03_rtc_settimeofday() static
sh: sh7757lcr: Make init_sh7757lcr_IRQ() static
sh: sh7757: Add missing #include <asm/mmzone.h>
sh: sh7785lcr: Make init_sh7785lcr_IRQ() static

arch/sh/boards/board-sh7757lcr.c | 2 +-
arch/sh/boards/board-sh7785lcr.c | 2 +-
arch/sh/boards/mach-highlander/pinmux-r7785rp.c | 1 +
arch/sh/boards/mach-sh03/rtc.c | 2 +-
arch/sh/include/asm/cacheflush.h | 12 ++++++++++++
arch/sh/kernel/cpu/sh4a/setup-sh7723.c | 3 +++
arch/sh/kernel/cpu/sh4a/setup-sh7724.c | 1 +
arch/sh/kernel/cpu/sh4a/setup-sh7757.c | 3 +++
arch/sh/kernel/traps_32.c | 4 ++--
arch/sh/mm/cache-sh4.c | 2 --
arch/sh/mm/cache-shx3.c | 1 +
arch/sh/mm/cache.c | 14 --------------
12 files changed, 26 insertions(+), 21 deletions(-)

--
2.34.1

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds


2024-03-04 19:11:23

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 4/7] sh: mach-sh03: Make sh03_rtc_settimeofday() static

arch/sh/boards/mach-sh03/rtc.c:123:5: warning: no previous prototype for ‘sh03_rtc_settimeofday’ [-Wmissing-prototypes]

There are no users outside this file, so make it static.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/sh/boards/mach-sh03/rtc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/boards/mach-sh03/rtc.c b/arch/sh/boards/mach-sh03/rtc.c
index 7fb474844a2d1d65..bc6cf995128c6547 100644
--- a/arch/sh/boards/mach-sh03/rtc.c
+++ b/arch/sh/boards/mach-sh03/rtc.c
@@ -120,7 +120,7 @@ static int set_rtc_mmss(struct rtc_time *tm)
return retval;
}

-int sh03_rtc_settimeofday(struct device *dev, struct rtc_time *tm)
+static int sh03_rtc_settimeofday(struct device *dev, struct rtc_time *tm)
{
return set_rtc_mmss(tm);
}
--
2.34.1


2024-03-04 19:11:12

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 2/7] sh: traps: Make is_dsp_inst() static

If CONFIG_SH_DSP=y (e.g. se7343_defconfig):

arch/sh/kernel/traps_32.c:572:5: warning: no previous prototype for ‘is_dsp_inst’ [-Wmissing-prototypes]

There are no users outside this file, so make it static.

While at it, convert the dummy for the CONFIG_SH_DSP=n case from a macro
to a static inline function, to increase type-safety.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/sh/kernel/traps_32.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/sh/kernel/traps_32.c b/arch/sh/kernel/traps_32.c
index 8cd4b05df75c3e07..1271b839a107ef28 100644
--- a/arch/sh/kernel/traps_32.c
+++ b/arch/sh/kernel/traps_32.c
@@ -569,7 +569,7 @@ asmlinkage void do_address_error(struct pt_regs *regs,
/*
* SH-DSP support [email protected].
*/
-int is_dsp_inst(struct pt_regs *regs)
+static int is_dsp_inst(struct pt_regs *regs)
{
unsigned short inst = 0;

@@ -591,7 +591,7 @@ int is_dsp_inst(struct pt_regs *regs)
return 0;
}
#else
-#define is_dsp_inst(regs) (0)
+static inline int is_dsp_inst(struct pt_regs *regs) { return 0; }
#endif /* CONFIG_SH_DSP */

#ifdef CONFIG_CPU_SH2A
--
2.34.1


2024-03-04 19:12:30

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 1/7] sh: cache: Move forward declarations to <asm/cacheflush.h>

arch/sh/kernel/cpu/init.c:99:29: warning: no previous prototype for 'l2_cache_init' [-Wmissing-prototypes]
arch/sh/kernel/cpu/sh4a/setup-sh7723.c:422:6: warning: no previous prototype for 'l2_cache_init' [-Wmissing-prototypes]
arch/sh/kernel/cpu/sh4a/setup-sh7724.c:842:6: warning: no previous prototype for 'l2_cache_init' [-Wmissing-prototypes]
arch/sh/mm/cache-j2.c:48:13: warning: no previous prototype for 'j2_cache_init' [-Wmissing-prototypes]
arch/sh/mm/cache-sh2.c:85:13: warning: no previous prototype for 'sh2_cache_init' [-Wmissing-prototypes]
arch/sh/mm/cache-sh2a.c:181:13: warning: no previous prototype for 'sh2a_cache_init' [-Wmissing-prototypes]
arch/sh/mm/cache-sh3.c:90:13: warning: no previous prototype for 'sh3_cache_init' [-Wmissing-prototypes]
arch/sh/mm/cache-sh4.c:384:13: warning: no previous prototype for 'sh4_cache_init' [-Wmissing-prototypes]
arch/sh/mm/cache-shx3.c:18:13: warning: no previous prototype for 'shx3_cache_init' [-Wmissing-prototypes]
arch/sh/mm/flush-sh4.c:106:13: warning: no previous prototype for 'sh4__flush_region_init' [-Wmissing-prototypes]
arch/sh/mm/cache-sh7705.c:190:13: warning: no previous prototype for 'sh7705_cache_init' [-Wmissing-prototypes]

Fix this by moving all cache-related forward declarations to
<asm/cacheflush.h>, and by including the latter where needed.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/sh/include/asm/cacheflush.h | 12 ++++++++++++
arch/sh/kernel/cpu/sh4a/setup-sh7723.c | 3 +++
arch/sh/kernel/cpu/sh4a/setup-sh7724.c | 1 +
arch/sh/mm/cache-sh4.c | 2 --
arch/sh/mm/cache-shx3.c | 1 +
arch/sh/mm/cache.c | 14 --------------
6 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/arch/sh/include/asm/cacheflush.h b/arch/sh/include/asm/cacheflush.h
index 51112f54552b329a..e6642ff148898bec 100644
--- a/arch/sh/include/asm/cacheflush.h
+++ b/arch/sh/include/asm/cacheflush.h
@@ -104,6 +104,18 @@ void kunmap_coherent(void *kvaddr);

void cpu_cache_init(void);

+void __weak l2_cache_init(void);
+
+void __weak j2_cache_init(void);
+void __weak sh2_cache_init(void);
+void __weak sh2a_cache_init(void);
+void __weak sh3_cache_init(void);
+void __weak shx3_cache_init(void);
+void __weak sh4_cache_init(void);
+void __weak sh7705_cache_init(void);
+
+void __weak sh4__flush_region_init(void);
+
static inline void *sh_cacheop_vaddr(void *vaddr)
{
if (__in_29bit_mode())
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
index 83ae1ad4a86e86b7..d64d28c4f0595d60 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7723.c
@@ -14,9 +14,12 @@
#include <linux/sh_timer.h>
#include <linux/sh_intc.h>
#include <linux/io.h>
+
+#include <asm/cacheflush.h>
#include <asm/clock.h>
#include <asm/mmzone.h>
#include <asm/platform_early.h>
+
#include <cpu/sh7723.h>

/* Serial */
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
index 0d990ab1ba2a9ed7..ef4b26a4b3d6428c 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7724.c
@@ -21,6 +21,7 @@
#include <linux/io.h>
#include <linux/notifier.h>

+#include <asm/cacheflush.h>
#include <asm/suspend.h>
#include <asm/clock.h>
#include <asm/mmzone.h>
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index 862046f26981b61d..195e739ee2be77d8 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -376,8 +376,6 @@ static void __flush_cache_one(unsigned long addr, unsigned long phys,
} while (--way_count != 0);
}

-extern void __weak sh4__flush_region_init(void);
-
/*
* SH-4 has virtually indexed and physically tagged cache.
*/
diff --git a/arch/sh/mm/cache-shx3.c b/arch/sh/mm/cache-shx3.c
index 24c58b7dc02265c7..dec039a75664083f 100644
--- a/arch/sh/mm/cache-shx3.c
+++ b/arch/sh/mm/cache-shx3.c
@@ -11,6 +11,7 @@
#include <linux/kernel.h>
#include <linux/io.h>
#include <asm/cache.h>
+#include <asm/cacheflush.h>

#define CCR_CACHE_SNM 0x40000 /* Hardware-assisted synonym avoidance */
#define CCR_CACHE_IBE 0x1000000 /* ICBI broadcast */
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index 9bcaa5619eabd142..ceffd3ffc81e3ee2 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -320,30 +320,20 @@ void __init cpu_cache_init(void)
goto skip;

if (boot_cpu_data.type == CPU_J2) {
- extern void __weak j2_cache_init(void);
-
j2_cache_init();
} else if (boot_cpu_data.family == CPU_FAMILY_SH2) {
- extern void __weak sh2_cache_init(void);
-
sh2_cache_init();
}

if (boot_cpu_data.family == CPU_FAMILY_SH2A) {
- extern void __weak sh2a_cache_init(void);
-
sh2a_cache_init();
}

if (boot_cpu_data.family == CPU_FAMILY_SH3) {
- extern void __weak sh3_cache_init(void);
-
sh3_cache_init();

if ((boot_cpu_data.type == CPU_SH7705) &&
(boot_cpu_data.dcache.sets == 512)) {
- extern void __weak sh7705_cache_init(void);
-
sh7705_cache_init();
}
}
@@ -351,14 +341,10 @@ void __init cpu_cache_init(void)
if ((boot_cpu_data.family == CPU_FAMILY_SH4) ||
(boot_cpu_data.family == CPU_FAMILY_SH4A) ||
(boot_cpu_data.family == CPU_FAMILY_SH4AL_DSP)) {
- extern void __weak sh4_cache_init(void);
-
sh4_cache_init();

if ((boot_cpu_data.type == CPU_SH7786) ||
(boot_cpu_data.type == CPU_SHX3)) {
- extern void __weak shx3_cache_init(void);
-
shx3_cache_init();
}
}
--
2.34.1


2024-03-04 19:12:10

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 6/7] sh: sh7757: Add missing #include <asm/mmzone.h>

arch/sh/kernel/cpu/sh4a/setup-sh7757.c:1240:13: warning: no previous prototype for ‘plat_mem_setup’ [-Wmissing-prototypes]

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/sh/kernel/cpu/sh4a/setup-sh7757.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
index 67e330b7ea4621e9..2ad19a0c5e04ef2a 100644
--- a/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
+++ b/arch/sh/kernel/cpu/sh4a/setup-sh7757.c
@@ -17,8 +17,11 @@
#include <linux/sh_dma.h>
#include <linux/sh_intc.h>
#include <linux/usb/ohci_pdriver.h>
+
#include <cpu/dma-register.h>
#include <cpu/sh7757.h>
+
+#include <asm/mmzone.h>
#include <asm/platform_early.h>

static struct plat_sci_port scif2_platform_data = {
--
2.34.1


2024-03-04 19:11:02

by Geert Uytterhoeven

[permalink] [raw]
Subject: [PATCH 5/7] sh: sh7757lcr: Make init_sh7757lcr_IRQ() static

arch/sh/boards/board-sh7757lcr.c:572:13: warning: no previous prototype for 'init_sh7757lcr_IRQ' [-Wmissing-prototypes]

There are no users outside this file, so make it static.

Signed-off-by: Geert Uytterhoeven <[email protected]>
---
arch/sh/boards/board-sh7757lcr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/sh/boards/board-sh7757lcr.c b/arch/sh/boards/board-sh7757lcr.c
index 4014c042d2a5a5c2..bca54e489e11678e 100644
--- a/arch/sh/boards/board-sh7757lcr.c
+++ b/arch/sh/boards/board-sh7757lcr.c
@@ -569,7 +569,7 @@ static int __init sh7757lcr_devices_setup(void)
arch_initcall(sh7757lcr_devices_setup);

/* Initialize IRQ setting */
-void __init init_sh7757lcr_IRQ(void)
+static void __init init_sh7757lcr_IRQ(void)
{
plat_irq_setup_pins(IRQ_MODE_IRQ7654);
plat_irq_setup_pins(IRQ_MODE_IRQ3210);
--
2.34.1