From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.free-electrons.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eOUWm-0005MC-5E for linux-mtd@lists.infradead.org; Mon, 11 Dec 2017 20:18:18 +0000 Date: Mon, 11 Dec 2017 21:17:50 +0100 From: Miquel RAYNAL To: Antoine Tenart Cc: Boris Brezillon , Richard Weinberger , David Woodhouse , Brian Norris , Marek Vasut , Cyrille Pitchen , linux-mtd@lists.infradead.org, Thomas Petazzoni , Gregory Clement , Nadav Haklai , Ofer Heifetz , Hanna Hawa Subject: Re: [PATCH v2] mtd: nand: add ->exec_op() implementation Message-ID: <20171211211750.0e74d951@xps13> In-Reply-To: <20171208075450.GA4359@kwain> References: <20171207145434.21586-1-miquel.raynal@free-electrons.com> <20171208075450.GA4359@kwain> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Hello Antoine, On Fri, 8 Dec 2017 08:54:50 +0100 Antoine Tenart wrote: > Hi Miquel, >=20 > 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=C3=A8l >=20 > On Thu, Dec 07, 2017 at 03:54:34PM +0100, Miquel Raynal wrote: > > + > > +#define NAND_OP_DATA_IN(l, buf, > > ns) \ > > + > > { \ > > + .type =3D > > NAND_OP_DATA_IN_INSTR, \ > > + .ctx.data =3D > > { \ > > + .len =3D > > l, \ > > + .buf.in =3D > > buf, \ =20 >=20 > Here. >=20 > > + .force_8bit =3D > > false, \ > > + }, > > \ > > + .delay_ns =3D > > ns, \ > > + } > > + > > +#define NAND_OP_DATA_OUT(l, buf, > > ns) \ > > + > > { \ > > + .type =3D > > NAND_OP_DATA_OUT_INSTR, \ > > + .ctx.data =3D > > { \ > > + .len =3D > > l, \ > > + .buf.out =3D > > buf, \ =20 >=20 > And here. >=20 > > + .force_8bit =3D > > false, \ > > + }, > > \ > > + .delay_ns =3D > > ns, \ > > + } =20 >=20 > 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. >=20 > Thanks! > Antoine >=20 --=20 Miquel Raynal, Free Electrons Embedded Linux and Kernel engineering http://free-electrons.com