[PATCH master 6/7] MIPS: longsoon: restart: hide access to zero page

Ahmad Fatoum a.fatoum at pengutronix.de
Sun Jun 4 23:29:38 PDT 2023


Watchdog on Longsoon appears to be at address 0. Let's use
OPTIMIZER_HIDE_VAR, so GCC doesn't warn about it.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 arch/mips/mach-loongson/loongson1_reset.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/mips/mach-loongson/loongson1_reset.c b/arch/mips/mach-loongson/loongson1_reset.c
index 85752f4ab825..9b4da217f80d 100644
--- a/arch/mips/mach-loongson/loongson1_reset.c
+++ b/arch/mips/mach-loongson/loongson1_reset.c
@@ -11,9 +11,13 @@
 
 static void __noreturn longhorn_restart_soc(struct restart_handler *rst)
 {
-	__raw_writel(0x1, WDT_EN);
-	__raw_writel(0x1, WDT_SET);
-	__raw_writel(0x1, WDT_TIMER);
+	void __iomem *wdt = IOMEM(0);
+
+	OPTIMIZER_HIDE_VAR(wdt);
+
+	__raw_writel(0x1, wdt + WDT_EN);
+	__raw_writel(0x1, wdt + WDT_SET);
+	__raw_writel(0x1, wdt + WDT_TIMER);
 
 	hang();
 }
-- 
2.39.2




More information about the barebox mailing list