summaryrefslogtreecommitdiff
path: root/drivers/mtd/mtdswap.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-01-02 15:48:54 +0400
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 22:26:24 +0400
commit8f461a730242c528ca221948edceca49266a3ffb (patch)
tree232b1d9ac6a74df87a84c9e1e6a61415afc9f583 /drivers/mtd/mtdswap.c
parent079c985e7a6f4ce60f931cebfdd5ee3c38347e31 (diff)
downloadlinux-8f461a730242c528ca221948edceca49266a3ffb.tar.xz
mtd: introduce mtd_can_have_bb helper
This patch introduces new 'mtd_can_have_bb()' helper function which checks whether the flash can have bad eraseblocks. Then it changes all the direct 'mtd->block_isbad' use cases with 'mtd_can_have_bb()'. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdswap.c')
-rw-r--r--drivers/mtd/mtdswap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mtd/mtdswap.c b/drivers/mtd/mtdswap.c
index fe4426c1c736..3fc8cb2756c0 100644
--- a/drivers/mtd/mtdswap.c
+++ b/drivers/mtd/mtdswap.c
@@ -343,7 +343,7 @@ static int mtdswap_read_markers(struct mtdswap_dev *d, struct swap_eb *eb)
offset = mtdswap_eb_offset(d, eb);
/* Check first if the block is bad. */
- if (d->mtd->block_isbad && mtd_block_isbad(d->mtd, offset))
+ if (mtd_can_have_bb(d->mtd) && mtd_block_isbad(d->mtd, offset))
return MTDSWAP_SCANNED_BAD;
ops.ooblen = 2 * d->mtd->ecclayout->oobavail;
@@ -1058,7 +1058,7 @@ static unsigned int mtdswap_badblocks(struct mtd_info *mtd, uint64_t size)
badcnt = 0;
- if (mtd->block_isbad)
+ if (mtd_can_have_bb(mtd))
for (offset = 0; offset < size; offset += mtd->erasesize)
if (mtd_block_isbad(mtd, offset))
badcnt++;