[PATCH v2] mtd: nand: add ->exec_op() implementation
Miquel RAYNAL
miquel.raynal at free-electrons.com
Mon Dec 11 12:17:50 PST 2017
Hello Antoine,
On Fri, 8 Dec 2017 08:54:50 +0100
Antoine Tenart <antoine.tenart at free-electrons.com> wrote:
> Hi Miquel,
>
> Be careful when defining macros: avoid to name your arguments with a
> value used in the macro that is not meant to be replaced.
That is right, it could have failed the macro.
Thank you for the tip,
Miquèl
>
> On Thu, Dec 07, 2017 at 03:54:34PM +0100, Miquel Raynal wrote:
> > +
> > +#define NAND_OP_DATA_IN(l, buf,
> > ns) \
> > +
> > { \
> > + .type =
> > NAND_OP_DATA_IN_INSTR, \
> > + .ctx.data =
> > { \
> > + .len =
> > l, \
> > + .buf.in =
> > buf, \
>
> Here.
>
> > + .force_8bit =
> > false, \
> > + },
> > \
> > + .delay_ns =
> > ns, \
> > + }
> > +
> > +#define NAND_OP_DATA_OUT(l, buf,
> > ns) \
> > +
> > { \
> > + .type =
> > NAND_OP_DATA_OUT_INSTR, \
> > + .ctx.data =
> > { \
> > + .len =
> > l, \
> > + .buf.out =
> > buf, \
>
> And here.
>
> > + .force_8bit =
> > false, \
> > + },
> > \
> > + .delay_ns =
> > ns, \
> > + }
>
> It works in your series because these macros are always called with
> the second argument being a variable named 'buf', but that's not safe.
>
> Thanks!
> Antoine
>
--
Miquel Raynal, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
More information about the linux-mtd
mailing list