Skip to contentSkip to conversation

MIPS: SiByte: Fix missing function prototypes

PATCH Applied Florian Fainelli 3 participants 7 messages Nov 13 – Nov 19 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 MIPS: SiByte: Fix missing function prototypes

The SB1250 SWARM build reports missing prototypes for platform time initialization, SoC setup, IRQ and SMP helpers, and both RTC backends.

---
Changes in v2:

- corrected warning reported by kbuild test robot by gating the inclusion of sb1250.h to avoid warnings on bcm63xx_defconfig

 arch/mips/include/asm/sibyte/sb1250.h  | 17 +++++++++++++++++
 arch/mips/mm/cerr-sb1.c                |  2 --
 arch/mips/mm/tlbex.c                   | 11 +++++++----
 arch/mips/sibyte/bcm1480/irq.c         |  4 +---
 arch/mips/sibyte/bcm1480/smp.c         |  6 +-----
 arch/mips/sibyte/bcm1480/time.c        |  4 ++--
 arch/mips/sibyte/common/bus_watcher.c  |  2 +-
 arch/mips/sibyte/sb1250/irq.c          |  4 +---
 arch/mips/sibyte/sb1250/smp.c          |  6 +-----
 arch/mips/sibyte/sb1250/time.c         |  4 ++--
 arch/mips/sibyte/swarm/rtc.h           | 15 +++++++++++++++
 arch/mips/sibyte/swarm/rtc_m41t81.c    |  1 +
 arch/mips/sibyte/swarm/rtc_xicor1241.c |  1 +
 arch/mips/sibyte/swarm/setup.c         | 18 ++----------------
 14 files changed, 52 insertions(+), 43 deletions(-)
 create mode 100644 arch/mips/sibyte/swarm/rtc.h
arch/mips/include/asm/sibyte/sb1250.h +17 -0
index de4b352256c8..ff97e77d4fe7 100644
@@ -32,9 +32,26 @@ extern unsigned int soc_type;
 extern unsigned int periph_rev;
 extern unsigned int zbbus_mhz;
 
+void sb1_cache_error(void);
+
+#ifdef CONFIG_SIBYTE_BUS_WATCHER
+void check_bus_watcher(void);
+#endif
+
+int sb1250_m3_workaround_needed(void);
+void sb1250_setup(void);
+void sb1250_clockevent_init(void);
+void sb1250_clocksource_init(void);
+void sb1250_mailbox_interrupt(void);
+
 extern void sb1250_mask_irq(int cpu, int irq);
 extern void sb1250_unmask_irq(int cpu, int irq);
 
+void bcm1480_setup(void);
+void sb1480_clockevent_init(void);
+void sb1480_clocksource_init(void);
+void bcm1480_mailbox_interrupt(void);
+
 extern void bcm1480_time_init(void);
 extern void bcm1480_mask_irq(int cpu, int irq);
 extern void bcm1480_unmask_irq(int cpu, int irq);
arch/mips/mm/cerr-sb1.c +0 -2
index a3c02df19f6f..6842244ac85b 100644
@@ -158,8 +158,6 @@ static void check_bus_watcher(void)
 		printk("Bus watcher indicates no error\n");
 	}
 }
-#else
-extern void check_bus_watcher(void);
 #endif
 
 asmlinkage void sb1_cache_error(void)
arch/mips/mm/tlbex.c +7 -4
index 69ea54bdc0c3..03a9b03c3d3a 100644
@@ -37,6 +37,9 @@
 #include <asm/regdef.h>
 #include <asm/uasm.h>
 #include <asm/setup.h>
+#ifdef CONFIG_SB1_PASS_2_WORKAROUNDS
+#include <asm/sibyte/sb1250.h>
+#endif
 #include <asm/tlbex.h>
 
 static int mips_xpa_disabled;
@@ -84,13 +87,13 @@ static inline int r4k_250MHZhwbug(void)
 	return 0;
 }
 
-extern int sb1250_m3_workaround_needed(void);
-
 static inline int __maybe_unused bcm1250_m3_war(void)
 {
-	if (IS_ENABLED(CONFIG_SB1_PASS_2_WORKAROUNDS))
-		return sb1250_m3_workaround_needed();
+#ifdef CONFIG_SB1_PASS_2_WORKAROUNDS
+	return sb1250_m3_workaround_needed();
+#else
 	return 0;
+#endif
 }
 
 static inline int __maybe_unused r10000_llsc_war(void)
arch/mips/sibyte/bcm1480/irq.c +1 -3
index 4c18a2c755d2..ab329a15d690 100644
@@ -198,7 +198,7 @@ static struct irq_chip bcm1480_irq_type = {
 #endif
 };
 
-void __init init_bcm1480_irqs(void)
+static void __init init_bcm1480_irqs(void)
 {
 	int i;
 
@@ -303,8 +303,6 @@ void __init arch_init_irq(void)
 	change_c0_status(ST0_IM, imask);
 }
 
-extern void bcm1480_mailbox_interrupt(void);
-
 static inline void dispatch_ip2(void)
 {
 	unsigned long long mask_h, mask_l;
arch/mips/sibyte/bcm1480/smp.c +1 -5
index 5861e50255bf..ea491f45d9ac 100644
@@ -46,7 +46,7 @@ static void *mailbox_0_regs[] = {
 /*
  * SMP init and finish on secondary CPUs
  */
-void bcm1480_smp_init(void)
+static void bcm1480_smp_init(void)
 {
 	unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 |
 		STATUSF_IP1 | STATUSF_IP0;
@@ -83,8 +83,6 @@ static void bcm1480_send_ipi_mask(const struct cpumask *mask,
  */
 static void bcm1480_init_secondary(void)
 {
-	extern void bcm1480_smp_init(void);
-
 	bcm1480_smp_init();
 }
 
@@ -94,8 +92,6 @@ static void bcm1480_init_secondary(void)
  */
 static void bcm1480_smp_finish(void)
 {
-	extern void sb1480_clockevent_init(void);
-
 	sb1480_clockevent_init();
 	local_irq_enable();
 }
arch/mips/sibyte/bcm1480/time.c +2 -2
index e6450d79fb4f..42db437af306 100644
@@ -4,8 +4,8 @@
  */
 #include <linux/init.h>
 
-extern void sb1480_clockevent_init(void);
-extern void sb1480_clocksource_init(void);
+#include <asm/time.h>
+#include <asm/sibyte/sb1250.h>
 
 void __init plat_time_init(void)
 {
arch/mips/sibyte/common/bus_watcher.c +1 -1
index a296d2c51841..5df4c82ac2a5 100644
@@ -189,7 +189,7 @@ static irqreturn_t sibyte_bw_int(int irq, void *data)
 	return IRQ_HANDLED;
 }
 
-int __init sibyte_bus_watcher(void)
+static int __init sibyte_bus_watcher(void)
 {
 	memset(&bw_stats, 0, sizeof(struct bw_stats_struct));
 	bw_stats.status_printed = 1;
arch/mips/sibyte/sb1250/irq.c +1 -3
index 57943fe3ac03..8108ead0cea8 100644
@@ -179,7 +179,7 @@ static struct irq_chip sb1250_irq_type = {
 #endif
 };
 
-void __init init_sb1250_irqs(void)
+static void __init init_sb1250_irqs(void)
 {
 	int i;
 
@@ -266,8 +266,6 @@ void __init arch_init_irq(void)
 	change_c0_status(ST0_IM, imask);
 }
 
-extern void sb1250_mailbox_interrupt(void);
-
 static inline void dispatch_ip2(void)
 {
 	unsigned int cpu = smp_processor_id();
arch/mips/sibyte/sb1250/smp.c +1 -5
index 7a794234e3d7..950d2e1c0de7 100644
@@ -35,7 +35,7 @@ static void *mailbox_regs[] = {
 /*
  * SMP init and finish on secondary CPUs
  */
-void sb1250_smp_init(void)
+static void sb1250_smp_init(void)
 {
 	unsigned int imask = STATUSF_IP4 | STATUSF_IP3 | STATUSF_IP2 |
 		STATUSF_IP1 | STATUSF_IP0;
@@ -72,8 +72,6 @@ static inline void sb1250_send_ipi_mask(const struct cpumask *mask,
  */
 static void sb1250_init_secondary(void)
 {
-	extern void sb1250_smp_init(void);
-
 	sb1250_smp_init();
 }
 
@@ -83,8 +81,6 @@ static void sb1250_init_secondary(void)
  */
 static void sb1250_smp_finish(void)
 {
-	extern void sb1250_clockevent_init(void);
-
 	sb1250_clockevent_init();
 	local_irq_enable();
 }
arch/mips/sibyte/sb1250/time.c +2 -2
index 8b63000a4dd5..3f7f64fe5690 100644
@@ -4,8 +4,8 @@
  */
 #include <linux/init.h>
 
-extern void sb1250_clocksource_init(void);
-extern void sb1250_clockevent_init(void);
+#include <asm/time.h>
+#include <asm/sibyte/sb1250.h>
 
 void __init plat_time_init(void)
 {
arch/mips/sibyte/swarm/rtc.h new file +15 -0
new file mode 100644
index 000000000000..64b8db786575
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#ifndef _SIBYTE_SWARM_RTC_H
+#define _SIBYTE_SWARM_RTC_H
+
+#include <linux/time64.h>
+
+int xicor_probe(void);
+int xicor_set_time(time64_t t);
+time64_t xicor_get_time(void);
+
+int m41t81_probe(void);
+int m41t81_set_time(time64_t t);
+time64_t m41t81_get_time(void);
+
+#endif /* _SIBYTE_SWARM_RTC_H */
arch/mips/sibyte/swarm/rtc_m41t81.c +1 -0
index afe1e3460bd4..e70ec1870674 100644
@@ -17,6 +17,7 @@
 #include <asm/sibyte/sb1250_regs.h>
 #include <asm/sibyte/sb1250_smbus.h>
 
+#include "rtc.h"
 
 /* M41T81 definitions */
 
arch/mips/sibyte/swarm/rtc_xicor1241.c +1 -0
index e2164200ceec..5bb2bc6a57d2 100644
@@ -17,6 +17,7 @@
 #include <asm/sibyte/sb1250_regs.h>
 #include <asm/sibyte/sb1250_smbus.h>
 
+#include "rtc.h"
 
 /* Xicor 1241 definitions */
 
arch/mips/sibyte/swarm/setup.c +2 -16
index 38c90b5e8754..a910961ad967 100644
@@ -35,28 +35,14 @@
 #include <asm/sibyte/sb1250_genbus.h>
 #include <asm/sibyte/board.h>
 
-#ifdef CONFIG_SIBYTE_BCM1x80
-extern void bcm1480_setup(void);
-#elif defined(CONFIG_SIBYTE_SB1250) || defined(CONFIG_SIBYTE_BCM112X)
-extern void sb1250_setup(void);
-#else
-#error invalid SiByte board configuration
-#endif
-
-extern int xicor_probe(void);
-extern int xicor_set_time(time64_t);
-extern time64_t xicor_get_time(void);
-
-extern int m41t81_probe(void);
-extern int m41t81_set_time(time64_t);
-extern time64_t m41t81_get_time(void);
+#include "rtc.h"
 
 const char *get_system_type(void)
 {
 	return "SiByte " SIBYTE_BOARD_NAME;
 }
 
-int swarm_be_handler(struct pt_regs *regs, int is_fixup)
+static int swarm_be_handler(struct pt_regs *regs, int is_fixup)
 {
 	if (!is_fixup && (regs->cp0_cause & 4)) {
 		/* Data bus error - print PA */
Signature · 1 line
2.53.0
maintainer Applied
#1 lore raw
Quoted 10 lines · Florian Fainelli

The SB1250 SWARM build reports missing prototypes for platform time initialization, SoC setup, IRQ and SMP helpers, and both RTC backends.

---
Changes in v2:

- corrected warning reported by kbuild test robot by gating the inclusion of sb1250.h to avoid warnings on bcm63xx_defconfig

Quoted 16 lines
 arch/mips/include/asm/sibyte/sb1250.h  | 17 +++++++++++++++++
 arch/mips/mm/cerr-sb1.c                |  2 --
 arch/mips/mm/tlbex.c                   | 11 +++++++----
 arch/mips/sibyte/bcm1480/irq.c         |  4 +---
 arch/mips/sibyte/bcm1480/smp.c         |  6 +-----
 arch/mips/sibyte/bcm1480/time.c        |  4 ++--
 arch/mips/sibyte/common/bus_watcher.c  |  2 +-
 arch/mips/sibyte/sb1250/irq.c          |  4 +---
 arch/mips/sibyte/sb1250/smp.c          |  6 +-----
 arch/mips/sibyte/sb1250/time.c         |  4 ++--
 arch/mips/sibyte/swarm/rtc.h           | 15 +++++++++++++++
 arch/mips/sibyte/swarm/rtc_m41t81.c    |  1 +
 arch/mips/sibyte/swarm/rtc_xicor1241.c |  1 +
 arch/mips/sibyte/swarm/setup.c         | 18 ++----------------
 14 files changed, 52 insertions(+), 43 deletions(-)
 create mode 100644 arch/mips/sibyte/swarm/rtc.h

applied to mips-next

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]
#2 lore raw
In reply to Florian Fainelli
Quoted 2 lines · Florian Fainelli

The SB1250 SWARM build reports missing prototypes for platform time initialization, SoC setup, IRQ and SMP helpers, and both RTC backends.

Thank you for doing this. I've meant to for a long time, but have been
distracted with higher priority stuff.

arch/mips/mm/tlbex.c static inline int r4k_250MHZhwbug(void) · line 97

Quoted 10 lines

static inline int __maybe_unused bcm1250_m3_war(void) {

arch/mips/mm/tlbex.c +4 -2
-	if (IS_ENABLED(CONFIG_SB1_PASS_2_WORKAROUNDS))
-		return sb1250_m3_workaround_needed();
+#ifdef CONFIG_SB1_PASS_2_WORKAROUNDS
+	return sb1250_m3_workaround_needed();
+#else
 	return 0;
+#endif
 }

It seems a style regression, why is this change needed?

Maciej

#3 lore raw
Quoted 8 lines · Maciej W. Rozycki
Quoted 2 lines · Florian Fainelli

The SB1250 SWARM build reports missing prototypes for platform time initialization, SoC setup, IRQ and SMP helpers, and both RTC backends.

Thank you for doing this. I've meant to for a long time, but have been
distracted with higher priority stuff.

Quoted 12 lines

arch/mips/mm/tlbex.c static inline int r4k_250MHZhwbug(void) · line 97

Quoted 10 lines
  static inline int __maybe_unused bcm1250_m3_war(void)
  {
arch/mips/mm/tlbex.c +4 -2
-	if (IS_ENABLED(CONFIG_SB1_PASS_2_WORKAROUNDS))
-		return sb1250_m3_workaround_needed();
+#ifdef CONFIG_SB1_PASS_2_WORKAROUNDS
+	return sb1250_m3_workaround_needed();
+#else
  	return 0;
+#endif
  }

It seems a style regression, why is this change needed?

The declaration is wrapped under #ifdef CONFIG_SB1_PASS_2_WORKAROUNDS, which would hide the prototype when the option was disabled. The if (IS_ENABLED() would not compile in that case since we would have lacked a visible declaration. We could keep this and just make the prototype unconditionally visible instead.

Thomas, I can send a v3 as an incremental fixup or complete replacement?

Signature · 1 line
Florian
#4 lore raw
Quoted 13 lines · Florian Fainelli
Quoted 4 lines
Quoted 4 lines
  static inline int __maybe_unused bcm1250_m3_war(void)
  {
arch/mips/mm/tlbex.c +0 -2
-	if (IS_ENABLED(CONFIG_SB1_PASS_2_WORKAROUNDS))
-		return sb1250_m3_workaround_needed();
Quoted 8 lines

arch/mips/mm/tlbex.c static inline int r4k_250MHZhwbug(void) · line 97

Quoted 6 lines
arch/mips/mm/tlbex.c +4 -0
+#ifdef CONFIG_SB1_PASS_2_WORKAROUNDS
+	return sb1250_m3_workaround_needed();
+#else
  	return 0;
+#endif
  }

It seems a style regression, why is this change needed?

Quoted 5 lines

The declaration is wrapped under #ifdef CONFIG_SB1_PASS_2_WORKAROUNDS, which would hide the prototype when the option was disabled. The if (IS_ENABLED() would not compile in that case since we would have lacked a visible declaration. We could keep this and just make the prototype unconditionally visible instead.

I've pondered it a bit more and I'm not entirely happy with the use of a
platform header in generic code in the first place. Would <asm/bugs.h> be a better place for the prototype?

Maciej

#5 lore raw
Quoted 21 lines · Maciej W. Rozycki
Quoted 13 lines · Florian Fainelli
Quoted 4 lines
Quoted 4 lines
   static inline int __maybe_unused bcm1250_m3_war(void)
   {
arch/mips/mm/tlbex.c +0 -2
-	if (IS_ENABLED(CONFIG_SB1_PASS_2_WORKAROUNDS))
-		return sb1250_m3_workaround_needed();
Quoted 8 lines

arch/mips/mm/tlbex.c static inline int r4k_250MHZhwbug(void) · line 97

Quoted 6 lines
arch/mips/mm/tlbex.c +4 -0
+#ifdef CONFIG_SB1_PASS_2_WORKAROUNDS
+	return sb1250_m3_workaround_needed();
+#else
   	return 0;
+#endif
   }

It seems a style regression, why is this change needed?

Quoted 5 lines

The declaration is wrapped under #ifdef CONFIG_SB1_PASS_2_WORKAROUNDS, which would hide the prototype when the option was disabled. The if (IS_ENABLED() would not compile in that case since we would have lacked a visible declaration. We could keep this and just make the prototype unconditionally visible instead.

Quoted 3 lines

I've pondered it a bit more and I'm not entirely happy with the use of a
platform header in generic code in the first place. Would <asm/bugs.h> be a better place for the prototype?

Yes, I like that, fixup coming up for Thomas to apply. Thanks!

Signature · 1 line
Florian
#6 lore raw
In reply to Florian Fainelli
Quoted 22 lines · Florian Fainelli
Quoted 8 lines · Maciej W. Rozycki
Quoted 2 lines · Florian Fainelli

The SB1250 SWARM build reports missing prototypes for platform time initialization, SoC setup, IRQ and SMP helpers, and both RTC backends.

Thank you for doing this. I've meant to for a long time, but have been
distracted with higher priority stuff.

Quoted 12 lines

arch/mips/mm/tlbex.c static inline int r4k_250MHZhwbug(void) · line 97

Quoted 10 lines
  static inline int __maybe_unused bcm1250_m3_war(void)
  {
arch/mips/mm/tlbex.c +4 -2
-	if (IS_ENABLED(CONFIG_SB1_PASS_2_WORKAROUNDS))
-		return sb1250_m3_workaround_needed();
+#ifdef CONFIG_SB1_PASS_2_WORKAROUNDS
+	return sb1250_m3_workaround_needed();
+#else
  	return 0;
+#endif
  }

It seems a style regression, why is this change needed?

Quoted 7 lines

The declaration is wrapped under #ifdef CONFIG_SB1_PASS_2_WORKAROUNDS, which would hide the prototype when the option was disabled. The if (IS_ENABLED() would not compile in that case since we would have lacked a visible declaration. We could keep this and just make the prototype unconditionally visible instead.

Thomas, I can send a v3 as an incremental fixup or complete replacement?

incremental fixup please

Thomas.

Signature · 2 lines
Crap can work. Given enough thrust pigs will fly, but it's not necessarily a
good idea.                                                [ RFC1925, 2.3 ]