Skip to contentSkip to conversation

MX5: Reuse the gd->tbl value for timestamp and add gd->lastinc for lastinc bss

PATCH New Stefano Babic 2 participants 3 messages Jan 23, 2011 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MX5: Reuse the gd->tbl value for timestamp and add gd->lastinc for lastinc bss

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.

---
 arch/arm/cpu/armv7/mx5/timer.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/mx5/timer.c +4 -2
index 3044fcf..1972f64 100644
@@ -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)
 {
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 MX5: Reuse the gd->tbl value for timestamp and add gd->lastinc for lastinc bss

Dear Stefano Babic,

Quoted 16 lines · In message <[email protected]> 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.

---
 arch/arm/cpu/armv7/mx5/timer.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
arch/arm/cpu/armv7/mx5/timer.c +0 -0
index 3044fcf..1972f64 100644

arch/arm/cpu/armv7/mx5/timer.c static struct mxc_gpt *cur_gpt = (struct mxc_gpt *)GPT1_BASE_ADDR; · line 50

Quoted 9 lines
arch/arm/cpu/armv7/mx5/timer.c +4 -2
@@ -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

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"UNIX was not designed to stop you from doing stupid things,  because
that would also stop you from doing clever things."       - Doug Gwyn
#2 lore raw

PATCH 1/1 MX5: Reuse the gd->tbl value for timestamp and add gd->lastinc for lastinc bss

Quoted 1 line · Wolfgang Denk

Why do we need these parens?

Checkpatch raises warnings without them.

Best regards,
Stefano Babic

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================