mtd: nand_base: replace ifdef with IS_ENABLE
Subsystems (2)
PATCH 1/1 mtd: nand_base: replace ifdef with IS_ENABLE
--- drivers/mtd/nand/nand_base.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/mtd/nand/nand_base.c +7 -7
@@ -445,15 +445,15 @@ static int nand_block_checkbad(struct mtd_info *mtd, loff_t ofs, int getchip, {struct nand_chip *chip = mtd->priv; -#ifdef CONFIG_NAND_BBT -if (!chip->bbt) -return chip->block_bad (mtd, ofs, getchip); +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); + } -/* Return info from the table */ -return nand_isbad_bbt (mtd, ofs, allowbbt); -#else return chip->block_bad (mtd, ofs, getchip); -#endif }/* Wait for the ready pin, after a command. The timeout is caught later. */
Signature · 7 lines
2.5.0 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 4 lines · Antony Pavlov
Signed-off-by Antony Pavlov <[email protected]>--- drivers/mtd/nand/nand_base.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
Applied, thanks
Sascha
Signature · 9 lines
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 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 7 lines · On Wed, 5 Aug 2015 09:53:56 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 4 lines · Antony Pavlov
Signed-off-by Antony Pavlov <[email protected]>--- 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.
I have to add something like this
#ifndef CONFIG_NAND_BBT
static inline nand_isbad_bbt(...) { };
#endif
to include/linux/mtd/nand.h.
--
Best regards,
Antony Pavlov
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Quoted 21 lines · Antony Pavlov
Quoted 7 lines · On Wed, 5 Aug 2015 09:53:56 +0200 Sascha Hauer <[email protected]> wrote:
Quoted 4 lines · Antony Pavlov
Signed-off-by Antony Pavlov <[email protected]>--- 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.
drivers/mtd/nand/nand_base.c +7
-0+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); + }
Quoted 5 lines
the
nand_isbad_bbt()function is defined indrivers/mtd/nand/nand_bbt.c, butnand_bbt.cis compiled-in only ifCONFIG_NAND_BBTis enabled.My current gcc-4.9.2-based toolchain has no problem with this,
but ifCONFIG_NAND_BBTis 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
Signature · 9 lines
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 | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox