[U-Boot] [PATCH 2/5] x86: Forward declate gd_t

Graeme Russ graeme.russ at gmail.com
Sun Apr 29 14:00:20 CEST 2012


So it can be used as a type in struct global_data and remove an ugly typecast

Signed-off-by: Graeme Russ <graeme.russ at gmail.com>
---
 arch/x86/cpu/cpu.c                 |    2 +-
 arch/x86/include/asm/global_data.h |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
index e9bb0d7..67de6bc 100644
--- a/arch/x86/cpu/cpu.c
+++ b/arch/x86/cpu/cpu.c
@@ -92,7 +92,7 @@ static void load_gdt(const u64 *boot_gdt, u16 num_entries)
 
 void init_gd(gd_t *id, u64 *gdt_addr)
 {
-	id->gd_addr = (ulong)id;
+	id->gd_addr = id;
 	setup_gdt(id, gdt_addr);
 }
 
diff --git a/arch/x86/include/asm/global_data.h b/arch/x86/include/asm/global_data.h
index 908a02c..8a8896e 100644
--- a/arch/x86/include/asm/global_data.h
+++ b/arch/x86/include/asm/global_data.h
@@ -35,9 +35,11 @@
 
 #ifndef __ASSEMBLY__
 
+typedef struct global_data gd_t;
+
 typedef	struct global_data {
 	/* NOTE: gd_addr MUST be first member of struct global_data! */
-	unsigned long	gd_addr;	/* Location of Global Data */
+	gd_t		*gd_addr;	/* Location of Global Data */
 	bd_t		*bd;
 	unsigned long	flags;
 	unsigned long	baudrate;
-- 
1.7.7.6



More information about the U-Boot mailing list