diff mbox

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

Message ID 1335700823-15144-3-git-send-email-graeme.russ@gmail.com
State Superseded, archived
Delegated to: Simon Glass
Headers show

Commit Message

Graeme Russ April 29, 2012, noon UTC
So it can be used as a type in struct global_data and remove an ugly typecast

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

Comments

Marek Vasut April 30, 2012, 2:23 a.m. UTC | #1
Dear Graeme Russ,

> So it can be used as a type in struct global_data and remove an ugly
> typecast
> 
> Signed-off-by: Graeme Russ <graeme.russ@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;

Acked-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut
Simon Glass Nov. 28, 2012, 1:28 a.m. UTC | #2
Hi,

On Sun, Apr 29, 2012 at 7:23 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Graeme Russ,
>
>> So it can be used as a type in struct global_data and remove an ugly
>> typecast
>>
>> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
>> ---
>>  arch/x86/cpu/cpu.c                 |    2 +-
>>  arch/x86/include/asm/global_data.h |    4 +++-
>>  2 files changed, 4 insertions(+), 2 deletions(-)

I had to modify this slightly to get it to build (added the same cast
fix to sdram.c as you did to cpu.c). Then, applied to x86/next.

Regards,
Simon
Marek Vasut Nov. 28, 2012, 1:29 a.m. UTC | #3
Dear Simon Glass,

> Hi,
> 
> On Sun, Apr 29, 2012 at 7:23 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Graeme Russ,
> > 
> >> So it can be used as a type in struct global_data and remove an ugly
> >> typecast
> >> 
> >> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
> >> ---
> >> 
> >>  arch/x86/cpu/cpu.c                 |    2 +-
> >>  arch/x86/include/asm/global_data.h |    4 +++-
> >>  2 files changed, 4 insertions(+), 2 deletions(-)
> 
> I had to modify this slightly to get it to build (added the same cast
> fix to sdram.c as you did to cpu.c). Then, applied to x86/next.

It'd be really nice if you could possibly take over the x86 custodianship from 
Graeme, it seems this arch is rotting :(

Best regards,
Marek Vasut
Simon Glass Nov. 28, 2012, 1:31 a.m. UTC | #4
Hi Marek,

On Tue, Nov 27, 2012 at 5:29 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Simon Glass,
>
>> Hi,
>>
>> On Sun, Apr 29, 2012 at 7:23 PM, Marek Vasut <marex@denx.de> wrote:
>> > Dear Graeme Russ,
>> >
>> >> So it can be used as a type in struct global_data and remove an ugly
>> >> typecast
>> >>
>> >> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
>> >> ---
>> >>
>> >>  arch/x86/cpu/cpu.c                 |    2 +-
>> >>  arch/x86/include/asm/global_data.h |    4 +++-
>> >>  2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> I had to modify this slightly to get it to build (added the same cast
>> fix to sdram.c as you did to cpu.c). Then, applied to x86/next.
>
> It'd be really nice if you could possibly take over the x86 custodianship from
> Graeme, it seems this arch is rotting :(

Your wish is my command :-)

Regards,
Simon

>
> Best regards,
> Marek Vasut
Marek Vasut Nov. 28, 2012, 1:35 a.m. UTC | #5
Dear Simon Glass,

> Hi Marek,
> 
> On Tue, Nov 27, 2012 at 5:29 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Simon Glass,
> > 
> >> Hi,
> >> 
> >> On Sun, Apr 29, 2012 at 7:23 PM, Marek Vasut <marex@denx.de> wrote:
> >> > Dear Graeme Russ,
> >> > 
> >> >> So it can be used as a type in struct global_data and remove an ugly
> >> >> typecast
> >> >> 
> >> >> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
> >> >> ---
> >> >> 
> >> >>  arch/x86/cpu/cpu.c                 |    2 +-
> >> >>  arch/x86/include/asm/global_data.h |    4 +++-
> >> >>  2 files changed, 4 insertions(+), 2 deletions(-)
> >> 
> >> I had to modify this slightly to get it to build (added the same cast
> >> fix to sdram.c as you did to cpu.c). Then, applied to x86/next.
> > 
> > It'd be really nice if you could possibly take over the x86 custodianship
> > from Graeme, it seems this arch is rotting :(
> 
> Your wish is my command :-)

Not so fast, this stuff is better discussed with both of those guys (CCed)

Best regards,
Marek Vasut
Graeme Russ Nov. 28, 2012, 1:37 a.m. UTC | #6
Hi Marek,

On Wed, Nov 28, 2012 at 12:35 PM, Marek Vasut <marex@denx.de> wrote:

> Dear Simon Glass,
>
> > Hi Marek,
> >
> > On Tue, Nov 27, 2012 at 5:29 PM, Marek Vasut <marex@denx.de> wrote:
> > > Dear Simon Glass,
> > >
> > >> Hi,
> > >>
> > >> On Sun, Apr 29, 2012 at 7:23 PM, Marek Vasut <marex@denx.de> wrote:
> > >> > Dear Graeme Russ,
> > >> >
> > >> >> So it can be used as a type in struct global_data and remove an
> ugly
> > >> >> typecast
> > >> >>
> > >> >> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
> > >> >> ---
> > >> >>
> > >> >>  arch/x86/cpu/cpu.c                 |    2 +-
> > >> >>  arch/x86/include/asm/global_data.h |    4 +++-
> > >> >>  2 files changed, 4 insertions(+), 2 deletions(-)
> > >>
> > >> I had to modify this slightly to get it to build (added the same cast
> > >> fix to sdram.c as you did to cpu.c). Then, applied to x86/next.
> > >
> > > It'd be really nice if you could possibly take over the x86
> custodianship
> > > from Graeme, it seems this arch is rotting :(
> >
> > Your wish is my command :-)
>
> Not so fast, this stuff is better discussed with both of those guys (CCed)
>
> You've either had too much beer or too little sleep (or both) - Simon took
over several weeks ago :)

Regards,

Graeme
Marek Vasut Nov. 28, 2012, 1:44 a.m. UTC | #7
Dear Graeme Russ,

> Hi Marek,
> 
> On Wed, Nov 28, 2012 at 12:35 PM, Marek Vasut <marex@denx.de> wrote:
> > Dear Simon Glass,
> > 
> > > Hi Marek,
> > > 
> > > On Tue, Nov 27, 2012 at 5:29 PM, Marek Vasut <marex@denx.de> wrote:
> > > > Dear Simon Glass,
> > > > 
> > > >> Hi,
> > > >> 
> > > >> On Sun, Apr 29, 2012 at 7:23 PM, Marek Vasut <marex@denx.de> wrote:
> > > >> > Dear Graeme Russ,
> > > >> > 
> > > >> >> So it can be used as a type in struct global_data and remove an
> > 
> > ugly
> > 
> > > >> >> typecast
> > > >> >> 
> > > >> >> Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
> > > >> >> ---
> > > >> >> 
> > > >> >>  arch/x86/cpu/cpu.c                 |    2 +-
> > > >> >>  arch/x86/include/asm/global_data.h |    4 +++-
> > > >> >>  2 files changed, 4 insertions(+), 2 deletions(-)
> > > >> 
> > > >> I had to modify this slightly to get it to build (added the same
> > > >> cast fix to sdram.c as you did to cpu.c). Then, applied to
> > > >> x86/next.
> > > > 
> > > > It'd be really nice if you could possibly take over the x86
> > 
> > custodianship
> > 
> > > > from Graeme, it seems this arch is rotting :(
> > > 
> > > Your wish is my command :-)
> > 
> > Not so fast, this stuff is better discussed with both of those guys
> > (CCed)
> > 
> > You've either had too much beer or too little sleep (or both) - Simon
> > took
> 
> over several weeks ago :)

I completely missed that, sorry :-(

Best regards,
Marek Vasut
diff mbox

Patch

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;