summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests/mtd_readtest.c
diff options
context:
space:
mode:
authorMorten Thunberg Svendsen2010-01-06 10:48:18 +0100
committerDavid Woodhouse2010-01-13 10:06:17 +0100
commitf5e2bae0aad03164ffc7ce9dfeee6608e2c87dba (patch)
tree6993fa233c58a12ffe4f8136a28309c2d9cc762e /drivers/mtd/tests/mtd_readtest.c
parentmtd: Really add ARM pismo support (diff)
downloadkernel-qcow2-linux-f5e2bae0aad03164ffc7ce9dfeee6608e2c87dba.tar.gz
kernel-qcow2-linux-f5e2bae0aad03164ffc7ce9dfeee6608e2c87dba.tar.xz
kernel-qcow2-linux-f5e2bae0aad03164ffc7ce9dfeee6608e2c87dba.zip
mtd: tests: fix read, speed and stress tests on NOR flash
Before using block_isbad() check if mtd->block_isbad() is defined. Calculating pgcnt must be done using pgsize defined to 512 on NOR and mtd->writesize for NAND, not using mtd->writesize directly. Signed-off-by: Morten Thunberg Svendsen <mts.doredevelopment@gmail.com> Acked-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/tests/mtd_readtest.c')
-rw-r--r--drivers/mtd/tests/mtd_readtest.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/mtd/tests/mtd_readtest.c b/drivers/mtd/tests/mtd_readtest.c
index 79fc4530987b..25c5dd03a837 100644
--- a/drivers/mtd/tests/mtd_readtest.c
+++ b/drivers/mtd/tests/mtd_readtest.c
@@ -147,6 +147,10 @@ static int scan_for_bad_eraseblocks(void)
}
memset(bbt, 0 , ebcnt);
+ /* NOR flash does not implement block_isbad */
+ if (mtd->block_isbad == NULL)
+ return 0;
+
printk(PRINT_PREF "scanning for bad eraseblocks\n");
for (i = 0; i < ebcnt; ++i) {
bbt[i] = is_block_bad(i) ? 1 : 0;
@@ -184,7 +188,7 @@ static int __init mtd_readtest_init(void)
tmp = mtd->size;
do_div(tmp, mtd->erasesize);
ebcnt = tmp;
- pgcnt = mtd->erasesize / mtd->writesize;
+ pgcnt = mtd->erasesize / pgsize;
printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, "
"page size %u, count of eraseblocks %u, pages per "