Patchwork [U-Boot] Move DECLARE_GLOBAL_DATA_PTR to file scope

login
register
mail settings
Submitter Wolfgang Denk
Date Dec. 21, 2010, 8:07 a.m.
Message ID <20101221080714.6FBA5B715C@gemini.denx.de>
Download mbox | patch
Permalink /patch/76267/
State Accepted
Headers show

Comments

Wolfgang Denk - Dec. 21, 2010, 8:07 a.m.
Dear John Rigby,

In message <1292894871-1436-1-git-send-email-john.rigby@linaro.org> you wrote:
> It can be optimised out by the compiler otherwise resulting
> in obscure errors like a board not booting.
> 
> This has been documented in README since 2006 when these were
> first fixed up for GCC 4.x.
> 
> Signed-off-by: John Rigby <john.rigby@linaro.org>

Thanks for the cleanup.  Much appreciated.

However, this patch appears to miss a few places.  I think we should
additionally change the following:


From 2ff61b7d2c288508d4873f1f80f7549886e00ee2 Mon Sep 17 00:00:00 2001
From: Wolfgang Denk <wd@denx.de>
Date: Tue, 21 Dec 2010 08:46:24 +0100
Subject: [PATCH] Move DECLARE_GLOBAL_DATA_PTR to file scope

Fix some additional places.

Signed-off-by: Wolfgang Denk <wd@denx.de>
---
 arch/arm/cpu/armv7/mx5/speed.c    |    2 ++
 arch/m68k/cpu/mcf52x2/cpu.c       |    3 +--
 arch/sh/lib/board.c               |    3 ---
 board/logicpd/zoom1/zoom1.c       |    1 -
 board/samsung/smdk6400/smdk6400.c |    2 --
 drivers/serial/serial_sh.c        |    1 -
 6 files changed, 3 insertions(+), 9 deletions(-)

Patch

diff --git a/arch/arm/cpu/armv7/mx5/speed.c b/arch/arm/cpu/armv7/mx5/speed.c
index 826b3b1..2187e8e 100644
--- a/arch/arm/cpu/armv7/mx5/speed.c
+++ b/arch/arm/cpu/armv7/mx5/speed.c
@@ -28,7 +28,9 @@ 
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
 
+#ifdef CONFIG_FSL_ESDHC
 DECLARE_GLOBAL_DATA_PTR;
+#endif
 
 int get_clocks(void)
 {
diff --git a/arch/m68k/cpu/mcf52x2/cpu.c b/arch/m68k/cpu/mcf52x2/cpu.c
index 9fb717c..fb60462 100644
--- a/arch/m68k/cpu/mcf52x2/cpu.c
+++ b/arch/m68k/cpu/mcf52x2/cpu.c
@@ -74,8 +74,7 @@  int watchdog_disable(void)
 {
 	volatile wdog_t *wdt = (volatile wdog_t *)(MMAP_WDOG);
 
-	wdt->sr = 0x5555; /* reset watchdog counteDECLARE_GLOBAL_DATA_PTR;
-r */
+	wdt->sr = 0x5555; /* reset watchdog counter */
 	wdt->sr = 0xAAAA;
 	wdt->cr = 0;	/* disable watchdog timer */
 
diff --git a/arch/sh/lib/board.c b/arch/sh/lib/board.c
index 8f50b09..3d201b2 100644
--- a/arch/sh/lib/board.c
+++ b/arch/sh/lib/board.c
@@ -99,7 +99,6 @@  static int sh_mem_env_init(void)
 #if defined(CONFIG_CMD_NET)
 static int sh_net_init(void)
 {
-	DECLARE_GLOBAL_DATA_PTR;
 	gd->bd->bi_ip_addr = getenv_IPaddr("ipaddr");
 	return 0;
 }
@@ -139,8 +138,6 @@  init_fnc_t *init_sequence[] =
 
 void sh_generic_init(void)
 {
-	DECLARE_GLOBAL_DATA_PTR;
-
 	bd_t *bd;
 	init_fnc_t **init_fnc_ptr;
 
diff --git a/board/logicpd/zoom1/zoom1.c b/board/logicpd/zoom1/zoom1.c
index efc2e1d..7ef13cc 100644
--- a/board/logicpd/zoom1/zoom1.c
+++ b/board/logicpd/zoom1/zoom1.c
@@ -41,7 +41,6 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-
 /*
  * Routine: board_init
  * Description: Early hardware init.
diff --git a/board/samsung/smdk6400/smdk6400.c b/board/samsung/smdk6400/smdk6400.c
index bc22f0f..35aa40b 100644
--- a/board/samsung/smdk6400/smdk6400.c
+++ b/board/samsung/smdk6400/smdk6400.c
@@ -80,8 +80,6 @@  int board_init(void)
 
 int dram_init(void)
 {
-	DECLARE_GLOBAL_DATA_PTR;
-
 	gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
 	gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
 
diff --git a/drivers/serial/serial_sh.c b/drivers/serial/serial_sh.c
index 30dea7c..0103a29 100644
--- a/drivers/serial/serial_sh.c
+++ b/drivers/serial/serial_sh.c
@@ -23,7 +23,6 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
-
 #if defined(CONFIG_CONS_SCIF0)
 # define SCIF_BASE	SCIF0_BASE
 #elif defined(CONFIG_CONS_SCIF1)