[PATCH] mtd: nand_base: replace ifdef with IS_ENABLE

Sascha Hauer s.hauer at pengutronix.de
Wed Aug 5 01:39:39 PDT 2015


On Wed, Aug 05, 2015 at 11:28:44AM +0300, Antony Pavlov wrote:
> On Wed, 5 Aug 2015 09:53:56 +0200
> Sascha Hauer <s.hauer at pengutronix.de> wrote:
> 
> > On Wed, Aug 05, 2015 at 09:10:34AM +0300, Antony Pavlov wrote:
> > > Signed-off-by: Antony Pavlov <antonynpavlov at gmail.com>
> > > ---
> > >  drivers/mtd/nand/nand_base.c | 14 +++++++-------
> > >  1 file changed, 7 insertions(+), 7 deletions(-)
> > 
> > Applied, thanks
> 
> It looks like I have to recall this patch.
> 
> +       if (IS_ENABLED(CONFIG_NAND_BBT)) {
> +               if (!chip->bbt)
> +                       return chip->block_bad(mtd, ofs, getchip);
> +
> +               /* Return info from the table */
> +               return nand_isbad_bbt(mtd, ofs, allowbbt);
> +       }
> 
> the nand_isbad_bbt() function is defined in drivers/mtd/nand/nand_bbt.c,
> but nand_bbt.c is compiled-in only if CONFIG_NAND_BBT is enabled.
> 
> My current gcc-4.9.2-based toolchain has no problem with this,
> but if CONFIG_NAND_BBT is disabled I suppose rather old toolchain can throw link error here.

If that throws a link error we would have tons of these problems
elsewhere. We currently heavily rely on the fact that gcc throws away
things inside if (0).

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list