aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/tests/mtd_speedtest.c
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/mtd/tests/mtd_speedtest.c
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/mtd/tests/mtd_speedtest.c')
-rw-r--r--drivers/mtd/tests/mtd_speedtest.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/mtd/tests/mtd_speedtest.c b/drivers/mtd/tests/mtd_speedtest.c
index 141363a7e805..56ca62bb96bf 100644
--- a/drivers/mtd/tests/mtd_speedtest.c
+++ b/drivers/mtd/tests/mtd_speedtest.c
@@ -24,6 +24,7 @@
24#include <linux/moduleparam.h> 24#include <linux/moduleparam.h>
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/mtd/mtd.h> 26#include <linux/mtd/mtd.h>
27#include <linux/slab.h>
27#include <linux/sched.h> 28#include <linux/sched.h>
28 29
29#define PRINT_PREF KERN_INFO "mtd_speedtest: " 30#define PRINT_PREF KERN_INFO "mtd_speedtest: "
@@ -301,6 +302,10 @@ static int scan_for_bad_eraseblocks(void)
301 } 302 }
302 memset(bbt, 0 , ebcnt); 303 memset(bbt, 0 , ebcnt);
303 304
305 /* NOR flash does not implement block_isbad */
306 if (mtd->block_isbad == NULL)
307 goto out;
308
304 printk(PRINT_PREF "scanning for bad eraseblocks\n"); 309 printk(PRINT_PREF "scanning for bad eraseblocks\n");
305 for (i = 0; i < ebcnt; ++i) { 310 for (i = 0; i < ebcnt; ++i) {
306 bbt[i] = is_block_bad(i) ? 1 : 0; 311 bbt[i] = is_block_bad(i) ? 1 : 0;
@@ -309,6 +314,7 @@ static int scan_for_bad_eraseblocks(void)
309 cond_resched(); 314 cond_resched();
310 } 315 }
311 printk(PRINT_PREF "scanned %d eraseblocks, %d are bad\n", i, bad); 316 printk(PRINT_PREF "scanned %d eraseblocks, %d are bad\n", i, bad);
317out:
312 goodebcnt = ebcnt - bad; 318 goodebcnt = ebcnt - bad;
313 return 0; 319 return 0;
314} 320}
@@ -340,7 +346,7 @@ static int __init mtd_speedtest_init(void)
340 tmp = mtd->size; 346 tmp = mtd->size;
341 do_div(tmp, mtd->erasesize); 347 do_div(tmp, mtd->erasesize);
342 ebcnt = tmp; 348 ebcnt = tmp;
343 pgcnt = mtd->erasesize / mtd->writesize; 349 pgcnt = mtd->erasesize / pgsize;
344 350
345 printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, " 351 printk(PRINT_PREF "MTD device size %llu, eraseblock size %u, "
346 "page size %u, count of eraseblocks %u, pages per " 352 "page size %u, count of eraseblocks %u, pages per "