public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: Miquel Raynal <miquel.raynal@free-electrons.com>,
	Richard Weinberger <richard@nod.at>,
	David Woodhouse <dwmw2@infradead.org>,
	Brian Norris <computersforpeace@gmail.com>,
	Marek Vasut <marek.vasut@gmail.com>,
	Cyrille Pitchen <cyrille.pitchen@wedev4u.fr>,
	linux-mtd@lists.infradead.org
Subject: Re: [PATCH] mtd: nand: Fix build issues due to an anonymous union
Date: Fri, 19 Jan 2018 11:33:59 -0800	[thread overview]
Message-ID: <20180119113359.22dd2de344c41f8bbdba844e@linux-foundation.org> (raw)
In-Reply-To: <20180119191339.551eed6d@bbrezillon>

On Fri, 19 Jan 2018 19:13:39 +0100 Boris Brezillon <boris.brezillon@free-electrons.com> wrote:

> On Fri, 19 Jan 2018 19:11:27 +0100
> Miquel Raynal <miquel.raynal@free-electrons.com> wrote:
> 
> > GCC-4.4.4 raises errors when assigning a parameter in an anonymous
> > union, leading to this kind of failure:
> > 
> > drivers/mtd/nand/marvell_nand.c:1936:
> >     warning: missing braces around initializer
> >     warning: (near initialization for '(anonymous)[1].<anonymous>')
> >     error: unknown field 'data' specified in initializer
> >     error: unknown field 'addr' specified in initializer
> > 
> > Work around the situation by naming these unions.
> > 
> > Reported-by: Andrew Morton <akpm@linux-foundation.org>
> > Signed-off-by: Miquel Raynal <miquel.raynal@free-electrons.com>

Tested-by: Andrew Morton <akpm@linux-foundation.org>

> > @@ -975,21 +975,27 @@ struct nand_op_parser_pattern_elem {
> >  	{							\
> >  		.type = NAND_OP_ADDR_INSTR,			\
> >  		.optional = _opt,				\
> > -		.addr.maxcycles = _maxcycles,			\
> > +		.ctx.addr = {					\
> > +			.maxcycles = _maxcycles,		\
> > +		},						\
> 
> Or just
> 		.ctx.addr.maxcycles = _maxcycles,
> 
> No need to send a new version, I'll fix it when applying.

Yes, this also works with gcc-4.4.4:

--- a/include/linux/mtd/rawnand.h~mtd-nand-fix-build-issues-due-to-an-anonymous-union-fix
+++ a/include/linux/mtd/rawnand.h
@@ -975,27 +975,21 @@ struct nand_op_parser_pattern_elem {
 	{							\
 		.type = NAND_OP_ADDR_INSTR,			\
 		.optional = _opt,				\
-		.ctx.addr = {					\
-			.maxcycles = _maxcycles,		\
-		},						\
+		.ctx.addr.maxcycles = _maxcycles,		\
 	}
 
 #define NAND_OP_PARSER_PAT_DATA_IN_ELEM(_opt, _maxlen)		\
 	{							\
 		.type = NAND_OP_DATA_IN_INSTR,			\
 		.optional = _opt,				\
-		.ctx.data = {					\
-			.maxlen = _maxlen,			\
-		},						\
+		.ctx.data.maxlen = _maxlen,			\
 	}
 
 #define NAND_OP_PARSER_PAT_DATA_OUT_ELEM(_opt, _maxlen)		\
 	{							\
 		.type = NAND_OP_DATA_OUT_INSTR,			\
 		.optional = _opt,				\
-		.ctx.data = {					\
-			.maxlen = _maxlen,			\
-		},						\
+		.ctx.data.maxlen = _maxlen,			\
 	}
 
 #define NAND_OP_PARSER_PAT_WAITRDY_ELEM(_opt)			\
_

  reply	other threads:[~2018-01-19 19:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 18:11 [PATCH] mtd: nand: Fix build issues due to an anonymous union Miquel Raynal
2018-01-19 18:13 ` Boris Brezillon
2018-01-19 19:33   ` Andrew Morton [this message]
2018-01-20 13:52 ` Boris Brezillon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180119113359.22dd2de344c41f8bbdba844e@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=cyrille.pitchen@wedev4u.fr \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=miquel.raynal@free-electrons.com \
    --cc=richard@nod.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox