diff mbox

[U-Boot] MX5: Reuse the gd->tbl value for timestamp and add gd->lastinc for lastinc bss

Message ID 1295798910-20382-1-git-send-email-sbabic@denx.de
State Accepted
Commit db106ef7ebf671b9ae15cfacbccdd485437440b0
Delegated to: Stefano Babic
Headers show

Commit Message

Stefano Babic Jan. 23, 2011, 4:08 p.m. UTC
The usage of bss values in drivers before initialisation of bss is forbidden.
In that special case some data in .rel.dyn gets corrupted.

This patch is the same as recently applied for arm926js architecture.

Signed-off-by: Stefano Babic <sbabic@denx.de>
CC: Heiko Schocher <hs@denx.de>
---
 arch/arm/cpu/armv7/mx5/timer.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

Comments

Wolfgang Denk Jan. 23, 2011, 4:28 p.m. UTC | #1
Dear Stefano Babic,

In message <1295798910-20382-1-git-send-email-sbabic@denx.de> you wrote:
> The usage of bss values in drivers before initialisation of bss is forbidden.
> In that special case some data in .rel.dyn gets corrupted.
> 
> This patch is the same as recently applied for arm926js architecture.
> 
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Heiko Schocher <hs@denx.de>
> ---
>  arch/arm/cpu/armv7/mx5/timer.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/cpu/armv7/mx5/timer.c b/arch/arm/cpu/armv7/mx5/timer.c
> index 3044fcf..1972f64 100644
> --- a/arch/arm/cpu/armv7/mx5/timer.c
> +++ b/arch/arm/cpu/armv7/mx5/timer.c
> @@ -44,8 +44,10 @@ static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR;
>  #define GPTCR_CLKSOURCE_32 (4<<6)	/* Clock source */
>  #define GPTCR_TEN       (1)	/* Timer enable */
>  
> -static ulong timestamp;
> -static ulong lastinc;
> +DECLARE_GLOBAL_DATA_PTR;
> +
> +#define timestamp (gd->tbl)
> +#define lastinc (gd->lastinc)

Why do we need these parens?

Best regards,

Wolfgang Denk
Stefano Babic Jan. 23, 2011, 4:30 p.m. UTC | #2
On 01/23/2011 05:28 PM, Wolfgang Denk wrote:

> Why do we need these parens?

Checkpatch raises warnings without them.

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/arch/arm/cpu/armv7/mx5/timer.c b/arch/arm/cpu/armv7/mx5/timer.c
index 3044fcf..1972f64 100644
--- a/arch/arm/cpu/armv7/mx5/timer.c
+++ b/arch/arm/cpu/armv7/mx5/timer.c
@@ -44,8 +44,10 @@  static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR;
 #define GPTCR_CLKSOURCE_32 (4<<6)	/* Clock source */
 #define GPTCR_TEN       (1)	/* Timer enable */
 
-static ulong timestamp;
-static ulong lastinc;
+DECLARE_GLOBAL_DATA_PTR;
+
+#define timestamp (gd->tbl)
+#define lastinc (gd->lastinc)
 
 int timer_init(void)
 {