[PATCH 11/78] ARM: shutdown: Fix compiler warning

Sascha Hauer s.hauer at pengutronix.de
Fri Mar 16 05:52:47 PDT 2018


On aarch64 we get a unused variable warning. Move the variable
declaration into the #ifdef where the variable is used.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/cpu/cpu.c | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/arch/arm/cpu/cpu.c b/arch/arm/cpu/cpu.c
index bf604fd60d..0e70a23260 100644
--- a/arch/arm/cpu/cpu.c
+++ b/arch/arm/cpu/cpu.c
@@ -89,6 +89,22 @@ void mmu_disable(void)
 }
 #endif
 
+static void disable_interrupts(void)
+{
+#if __LINUX_ARM_ARCH__ <= 7
+	uint32_t r;
+
+	/*
+	 * barebox normally does not use interrupts, but some functionalities
+	 * (eg. OMAP4_USBBOOT) require them enabled. So be sure interrupts are
+	 * disabled before exiting.
+	 */
+	__asm__ __volatile__("mrs %0, cpsr" : "=r"(r));
+	r |= PSR_I_BIT;
+	__asm__ __volatile__("msr cpsr, %0" : : "r"(r));
+#endif
+}
+
 /**
  * Disable MMU and D-cache, flush caches
  * @return 0 (always)
@@ -98,23 +114,13 @@ void mmu_disable(void)
  */
 static void arch_shutdown(void)
 {
-	uint32_t r;
 
 #ifdef CONFIG_MMU
 	mmu_disable();
 #endif
 	icache_invalidate();
 
-#if __LINUX_ARM_ARCH__ <= 7
-	/*
-	 * barebox normally does not use interrupts, but some functionalities
-	 * (eg. OMAP4_USBBOOT) require them enabled. So be sure interrupts are
-	 * disabled before exiting.
-	 */
-	__asm__ __volatile__("mrs %0, cpsr" : "=r"(r));
-	r |= PSR_I_BIT;
-	__asm__ __volatile__("msr cpsr, %0" : : "r"(r));
-#endif
+	disable_interrupts();
 }
 archshutdown_exitcall(arch_shutdown);
 
-- 
2.16.1




More information about the barebox mailing list