Patchwork [U-Boot] Use sizeof(gd_t), not sizeof(struct global_data)

login
register
mail settings
Submitter Wolfgang Denk
Date Jan. 3, 2011, 4:51 p.m.
Message ID <20110103165146.395B0CEF7A6@gemini.denx.de>
Download mbox | patch
Permalink /patch/77297/
State Accepted
Commit de47cbe6860654cc6c0cf8820d9165f059c7cf38
Headers show

Comments

Wolfgang Denk - Jan. 3, 2011, 4:51 p.m.
Dear =?UTF-8?q?Lo=C3=AFc=20Minier?=,

In message <1294069652-9114-1-git-send-email-loic.minier@linaro.org> you wrote:
> The eNET (x86) build fails with "invalid application of 'sizeof' to
> incomplete type 'struct global_data'" because x86 doesn't define
> struct global_data.  Change sizeof(struct global_data) to sizeof(gd_t)
> which is always available.

Um... I do not like this change; the resulting code is harder to read.

Can you please change the struct declaration isntead, like this:


Best regards,

Wolfgang Denk
Loïc Minier - Jan. 3, 2011, 5:03 p.m.
On Mon, Jan 03, 2011, Wolfgang Denk wrote:
> Um... I do not like this change; the resulting code is harder to read.

 I don't mind either way; I had asked
 <20101220111358.GA28532@bee.dooz.org> which one was the preferred
 approach, but didn't get comments on this particular point; see
 <20110103170050.GB10571@bee.dooz.org> for the rationale for picking
 this option rather than the other one.

 I've sent a second patch to also define struct global_data; feel free
 to cherry pick any of the two patches or both

   Thanks!

Patch

diff --git a/arch/i386/include/asm/global_data.h b/arch/i386/include/asm/global_data.h
index e3f8a25..e9000c3 100644
--- a/arch/i386/include/asm/global_data.h
+++ b/arch/i386/include/asm/global_data.h
@@ -35,7 +35,7 @@ 
 
 #ifndef __ASSEMBLY__
 
-typedef	struct {
+typedef	struct global_data {
 	bd_t		*bd;
 	unsigned long	flags;
 	unsigned long	baudrate;