[PATCH] mtd: nand: Fix build issues due to an anonymous union
Andrew Morton
akpm at linux-foundation.org
Fri Jan 19 11:33:59 PST 2018
On Fri, 19 Jan 2018 19:13:39 +0100 Boris Brezillon <boris.brezillon at free-electrons.com> wrote:
> On Fri, 19 Jan 2018 19:11:27 +0100
> Miquel Raynal <miquel.raynal at 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 at linux-foundation.org>
> > Signed-off-by: Miquel Raynal <miquel.raynal at free-electrons.com>
Tested-by: Andrew Morton <akpm at 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) \
_
More information about the linux-mtd
mailing list