Commit c1a72e2d authored by Miquel Raynal's avatar Miquel Raynal Committed by Boris Brezillon

mtd: nand: Fix build issues due to an anonymous union

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.

Fixes: 8878b126 ("mtd: nand: add ->exec_op() implementation")
Reported-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarMiquel Raynal <miquel.raynal@free-electrons.com>
Tested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@free-electrons.com>
parent c495a927
......@@ -2335,23 +2335,24 @@ nand_op_parser_must_split_instr(const struct nand_op_parser_pattern_elem *pat,
{
switch (pat->type) {
case NAND_OP_ADDR_INSTR:
if (!pat->addr.maxcycles)
if (!pat->ctx.addr.maxcycles)
break;
if (instr->ctx.addr.naddrs - *start_offset >
pat->addr.maxcycles) {
*start_offset += pat->addr.maxcycles;
pat->ctx.addr.maxcycles) {
*start_offset += pat->ctx.addr.maxcycles;
return true;
}
break;
case NAND_OP_DATA_IN_INSTR:
case NAND_OP_DATA_OUT_INSTR:
if (!pat->data.maxlen)
if (!pat->ctx.data.maxlen)
break;
if (instr->ctx.data.len - *start_offset > pat->data.maxlen) {
*start_offset += pat->data.maxlen;
if (instr->ctx.data.len - *start_offset >
pat->ctx.data.maxlen) {
*start_offset += pat->ctx.data.maxlen;
return true;
}
break;
......
......@@ -962,7 +962,7 @@ struct nand_op_parser_pattern_elem {
union {
struct nand_op_parser_addr_constraints addr;
struct nand_op_parser_data_constraints data;
};
} ctx;
};
#define NAND_OP_PARSER_PAT_CMD_ELEM(_opt) \
......@@ -975,21 +975,21 @@ struct nand_op_parser_pattern_elem {
{ \
.type = NAND_OP_ADDR_INSTR, \
.optional = _opt, \
.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, \
.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, \
.data.maxlen = _maxlen, \
.ctx.data.maxlen = _maxlen, \
}
#define NAND_OP_PARSER_PAT_WAITRDY_ELEM(_opt) \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment