diff options
author | Jeff Westfahl <jeff.westfahl@ni.com> | 2017-01-10 13:30:17 -0600 |
---|---|---|
committer | Brian Norris <computersforpeace@gmail.com> | 2017-02-08 13:53:52 -0800 |
commit | 6080ef6e7c0a0592cbcca11200d879faf65e27d4 (patch) | |
tree | 509d57287040d86a9fe5459bd501ec0cbe6da66f /drivers/mtd | |
parent | 7da0fffb3a4cb76a4869bf12acb750a4f9e2f2c1 (diff) | |
download | blackbird-op-linux-6080ef6e7c0a0592cbcca11200d879faf65e27d4.tar.gz blackbird-op-linux-6080ef6e7c0a0592cbcca11200d879faf65e27d4.zip |
mtd: introduce function max_bad_blocks
If implemented, 'max_bad_blocks' returns the maximum number of bad
blocks to reserve for a MTD. An implementation for NAND is coming soon.
Signed-off-by: Jeff Westfahl <jeff.westfahl@ni.com>
Signed-off-by: Zach Brown <zach.brown@ni.com>
Acked-by: Boris Brezillon <boris.brezillon@free-electron.com>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/mtdpart.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c index fccdd49bb964..08925bb68fd6 100644 --- a/drivers/mtd/mtdpart.c +++ b/drivers/mtd/mtdpart.c @@ -349,6 +349,14 @@ static const struct mtd_ooblayout_ops part_ooblayout_ops = { .free = part_ooblayout_free, }; +static int part_max_bad_blocks(struct mtd_info *mtd, loff_t ofs, size_t len) +{ + struct mtd_part *part = mtd_to_part(mtd); + + return part->master->_max_bad_blocks(part->master, + ofs + part->offset, len); +} + static inline void free_partition(struct mtd_part *p) { kfree(p->mtd.name); @@ -475,6 +483,8 @@ static struct mtd_part *allocate_partition(struct mtd_info *master, slave->mtd._block_isbad = part_block_isbad; if (master->_block_markbad) slave->mtd._block_markbad = part_block_markbad; + if (master->_max_bad_blocks) + slave->mtd._max_bad_blocks = part_max_bad_blocks; if (master->_get_device) slave->mtd._get_device = part_get_device; |