diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2020-12-10 16:12:55 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2020-12-11 10:58:50 +0100 |
commit | bea662b621fc7544931e2685640015d1b58872e6 (patch) | |
tree | 65bd0b81017e31dc25e6c3e3bbee64ac6c2bfd32 /drivers/mtd/nand/nand_bbt.c | |
parent | 4a15f9141efa8fb75323517f76594bfaec38bcf9 (diff) | |
download | barebox-bea662b621fc7544931e2685640015d1b58872e6.tar.gz barebox-bea662b621fc7544931e2685640015d1b58872e6.tar.xz |
mtd: nand: Make write support optional
NAND write support used to be optional and the correspoding
CONFIG_MTD_WRITE option still exists. Bail out early from the write
functions when CONFIG_MTD_WRITE is disabled like we used to before the
last NAND layer update.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mtd/nand/nand_bbt.c')
-rw-r--r-- | drivers/mtd/nand/nand_bbt.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c index f582799636..a86b5b2da3 100644 --- a/drivers/mtd/nand/nand_bbt.c +++ b/drivers/mtd/nand/nand_bbt.c @@ -1018,14 +1018,16 @@ static int check_create(struct nand_chip *this, uint8_t *buf, } /* Write the bad block table to the device? */ - if ((writeops & 0x01) && (td->options & NAND_BBT_WRITE)) { + if ((writeops & 0x01) && (td->options & NAND_BBT_WRITE) && + IS_ENABLED(CONFIG_MTD_WRITE)) { res = write_bbt(this, buf, td, md, chipsel); if (res < 0) return res; } /* Write the mirror bad block table to the device? */ - if ((writeops & 0x02) && md && (md->options & NAND_BBT_WRITE)) { + if ((writeops & 0x02) && md && (md->options & NAND_BBT_WRITE) && + IS_ENABLED(CONFIG_MTD_WRITE)) { res = write_bbt(this, buf, md, td, chipsel); if (res < 0) return res; @@ -1074,13 +1076,13 @@ int nand_update_bbt(struct nand_chip *this, loff_t offs) md->version[chip]++; /* Write the bad block table to the device? */ - if (td->options & NAND_BBT_WRITE) { + if ((td->options & NAND_BBT_WRITE) && IS_ENABLED(CONFIG_MTD_WRITE)) { res = write_bbt(this, buf, td, md, chipsel); if (res < 0) goto out; } /* Write the mirror bad block table to the device? */ - if (md && (md->options & NAND_BBT_WRITE)) { + if (md && (md->options & NAND_BBT_WRITE) && IS_ENABLED(CONFIG_MTD_WRITE)) { res = write_bbt(this, buf, md, td, chipsel); } |