[PATCH] prevent 'BUG: sleeping function called from invalid context' in arch_reset()

Lothar Waßmann LW at KARO-electronics.de
Mon Nov 29 04:25:34 EST 2010


arch_reset() may be called from interrupt context (e.g. induced by
SYSRQ-B), thus clk_get() and clk_enable() must not be called from
within arch_reset(). Move these calls to mxc_arch_reset_init().

Signed-off-by: Lothar Waßmann <LW at KARO-electronics.de>
---
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index c3972c5..9b02251 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -53,11 +53,6 @@ void arch_reset(char mode, const char *cmd)
 	if (cpu_is_mx1()) {
 		wcr_enable = (1 << 0);
 	} else {
-		struct clk *clk;
-
-		clk = clk_get_sys("imx-wdt.0", NULL);
-		if (!IS_ERR(clk))
-			clk_enable(clk);
 		wcr_enable = (1 << 2);
 	}
 
@@ -78,5 +73,14 @@ void arch_reset(char mode, const char *cmd)
 
 void mxc_arch_reset_init(void __iomem *base)
 {
+	struct clk *clk;
+
 	wdog_base = base;
+
+	if (cpu_is_mx1())
+		return;
+
+	clk = clk_get_sys("imx-wdt.0", NULL);
+	if (!IS_ERR(clk))
+		clk_enable(clk);
 }


Lothar Waßmann
-- 
___________________________________________________________

Ka-Ro electronics GmbH | Pascalstraße 22 | D - 52076 Aachen
Phone: +49 2408 1402-0 | Fax: +49 2408 1402-10
Geschäftsführer: Matthias Kaussen
Handelsregistereintrag: Amtsgericht Aachen, HRB 4996

www.karo-electronics.de | info at karo-electronics.de
___________________________________________________________



More information about the linux-arm-kernel mailing list