MIPS: Allow modules to set board_be_handler
authorFlorian Fainelli <f.fainelli@gmail.com>
Fri, 5 Nov 2021 17:30:47 +0000 (10:30 -0700)
committerThomas Bogendoerfer <tsbogend@alpha.franken.de>
Tue, 9 Nov 2021 15:07:26 +0000 (16:07 +0100)
After making the brcmstb_gisb driver modular with 707a4cdf86e5 ("bus:
brcmstb_gisb: Allow building as module") Guenter reported that mips
allmodconfig failed to link because board_be_handler was referenced.

Thomas indicated that if we were to continue making the brcmstb_gisb
driver modular for MIPS we would need to introduce a function that
allows setting the board_be_handler and export that function towards
modules.

This is what is being done here: board_be_handler is made static and is
now settable with a mips_set_be_handler() function which is exported.

Reported-by: Guenter Roeck <linux@roeck-us.net>
Suggested-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Fixes: 707a4cdf86e5 ("bus: brcmstb_gisb: Allow building as module")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
12 files changed:
arch/mips/dec/setup.c
arch/mips/include/asm/traps.h
arch/mips/kernel/traps.c
arch/mips/sgi-ip22/ip22-berr.c
arch/mips/sgi-ip22/ip28-berr.c
arch/mips/sgi-ip27/ip27-berr.c
arch/mips/sgi-ip32/ip32-berr.c
arch/mips/sibyte/swarm/setup.c
arch/mips/txx9/generic/setup_tx4927.c
arch/mips/txx9/generic/setup_tx4938.c
arch/mips/txx9/generic/setup_tx4939.c
drivers/bus/brcmstb_gisb.c

index eaad0ed4b523bbc0ee70c58c994f91a9c59d0818..a8a30bb1dee8c1e1e65d4a822e0e7c8ef40016ca 100644 (file)
@@ -117,21 +117,21 @@ static void __init dec_be_init(void)
 {
        switch (mips_machtype) {
        case MACH_DS23100:      /* DS2100/DS3100 Pmin/Pmax */
-               board_be_handler = dec_kn01_be_handler;
+               mips_set_be_handler(dec_kn01_be_handler);
                busirq_handler = dec_kn01_be_interrupt;
                busirq_flags |= IRQF_SHARED;
                dec_kn01_be_init();
                break;
        case MACH_DS5000_1XX:   /* DS5000/1xx 3min */
        case MACH_DS5000_XX:    /* DS5000/xx Maxine */
-               board_be_handler = dec_kn02xa_be_handler;
+               mips_set_be_handler(dec_kn02xa_be_handler);
                busirq_handler = dec_kn02xa_be_interrupt;
                dec_kn02xa_be_init();
                break;
        case MACH_DS5000_200:   /* DS5000/200 3max */
        case MACH_DS5000_2X0:   /* DS5000/240 3max+ */
        case MACH_DS5900:       /* DS5900 bigmax */
-               board_be_handler = dec_ecc_be_handler;
+               mips_set_be_handler(dec_ecc_be_handler);
                busirq_handler = dec_ecc_be_interrupt;
                dec_ecc_be_init();
                break;
index b710e76c9c658f7baaef01601cef79277020d7ef..15cde638b4070ca090e13adb34aec0122756e68b 100644 (file)
@@ -15,7 +15,7 @@
 #define MIPS_BE_FATAL  2               /* treat as an unrecoverable error */
 
 extern void (*board_be_init)(void);
-extern int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
+void mips_set_be_handler(int (*handler)(struct pt_regs *reg, int is_fixup));
 
 extern void (*board_nmi_handler_setup)(void);
 extern void (*board_ejtag_handler_setup)(void);
index 6f07362de5cec29d1d9d4870ec23da84a854748d..d26b0fb8ea067e524af129541cb4172e11435fd3 100644 (file)
@@ -103,13 +103,19 @@ extern asmlinkage void handle_reserved(void);
 extern void tlb_do_page_fault_0(void);
 
 void (*board_be_init)(void);
-int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
+static int (*board_be_handler)(struct pt_regs *regs, int is_fixup);
 void (*board_nmi_handler_setup)(void);
 void (*board_ejtag_handler_setup)(void);
 void (*board_bind_eic_interrupt)(int irq, int regset);
 void (*board_ebase_setup)(void);
 void(*board_cache_error_setup)(void);
 
+void mips_set_be_handler(int (*handler)(struct pt_regs *regs, int is_fixup))
+{
+       board_be_handler = handler;
+}
+EXPORT_SYMBOL_GPL(mips_set_be_handler);
+
 static void show_raw_backtrace(unsigned long reg29, const char *loglvl,
                               bool user)
 {
index dc0110a607a5b4dd469ee54e245b511c5a59538e..afe8a61078e40f2a2931418cb5e7dfe583dfec5d 100644 (file)
@@ -112,5 +112,5 @@ static int ip22_be_handler(struct pt_regs *regs, int is_fixup)
 
 void __init ip22_be_init(void)
 {
-       board_be_handler = ip22_be_handler;
+       mips_set_be_handler(ip22_be_handler);
 }
index c61362d9ea95dec5502189f00433ddd4dfeae25f..16ca470deb8096ef77aa7ec700230570823c579c 100644 (file)
@@ -468,7 +468,7 @@ static int ip28_be_handler(struct pt_regs *regs, int is_fixup)
 
 void __init ip22_be_init(void)
 {
-       board_be_handler = ip28_be_handler;
+       mips_set_be_handler(ip28_be_handler);
 }
 
 int ip28_show_be_info(struct seq_file *m)
index 5a38ae6bdfa91a832fb5fec5eb62f06d6619a5a8..923a63a51cda39482c227936c17f828ceae3227b 100644 (file)
@@ -85,7 +85,7 @@ void __init ip27_be_init(void)
        int cpu = LOCAL_HUB_L(PI_CPU_NUM);
        int cpuoff = cpu << 8;
 
-       board_be_handler = ip27_be_handler;
+       mips_set_be_handler(ip27_be_handler);
 
        LOCAL_HUB_S(PI_ERR_INT_PEND,
                    cpu ? PI_ERR_CLEAR_ALL_B : PI_ERR_CLEAR_ALL_A);
index c860f95ab7edd44147ac6d99a8c07b16b2d95253..478b63b4c808f35456bb0b4ba69de4450edb7404 100644 (file)
@@ -34,5 +34,5 @@ static int ip32_be_handler(struct pt_regs *regs, int is_fixup)
 
 void __init ip32_be_init(void)
 {
-       board_be_handler = ip32_be_handler;
+       mips_set_be_handler(ip32_be_handler);
 }
index 538a2791b48ca9ab20751590eeff5f02b1b8877a..78ae2c9d4f2a325d3dafdc3f755f54e097573805 100644 (file)
@@ -123,7 +123,7 @@ void __init plat_mem_setup(void)
 #error invalid SiByte board configuration
 #endif
 
-       board_be_handler = swarm_be_handler;
+       mips_set_be_handler(swarm_be_handler);
 
        if (xicor_probe())
                swarm_rtc_type = RTC_XICOR;
index 46e9c41013862c960c84e5d26266855c444adb01..63f9725b2eb08afc73a450a539054e95fbb3af00 100644 (file)
@@ -80,7 +80,7 @@ static int tx4927_be_handler(struct pt_regs *regs, int is_fixup)
 }
 static void __init tx4927_be_init(void)
 {
-       board_be_handler = tx4927_be_handler;
+       mips_set_be_handler(tx4927_be_handler);
 }
 
 static struct resource tx4927_sdram_resource[4];
index 17395d5d15caf9738ec69b3af7e6c17b922603dc..ba646548c5f694bdefb97db7332c5a782d2a8a4a 100644 (file)
@@ -82,7 +82,7 @@ static int tx4938_be_handler(struct pt_regs *regs, int is_fixup)
 }
 static void __init tx4938_be_init(void)
 {
-       board_be_handler = tx4938_be_handler;
+       mips_set_be_handler(tx4938_be_handler);
 }
 
 static struct resource tx4938_sdram_resource[4];
index bf8a3cdababf75b7e67fa0097729775e7e445771..f5f59b7401a3d3b737fc13d2e827eb31cca81dfe 100644 (file)
@@ -86,7 +86,7 @@ static int tx4939_be_handler(struct pt_regs *regs, int is_fixup)
 }
 static void __init tx4939_be_init(void)
 {
-       board_be_handler = tx4939_be_handler;
+       mips_set_be_handler(tx4939_be_handler);
 }
 
 static struct resource tx4939_sdram_resource[4];
index 6551286a60cc4053677b38487cde89305b460dc1..6cc965324cc546d973241404ad702a708b839c4a 100644 (file)
@@ -485,7 +485,7 @@ static int __init brcmstb_gisb_arb_probe(struct platform_device *pdev)
        list_add_tail(&gdev->next, &brcmstb_gisb_arb_device_list);
 
 #ifdef CONFIG_MIPS
-       board_be_handler = brcmstb_bus_error_handler;
+       mips_set_be_handler(brcmstb_bus_error_handler);
 #endif
 
        if (list_is_singular(&brcmstb_gisb_arb_device_list)) {