blob: f10b5c54d03e69bae6317d56d103c4371408d3e9 [file] [log] [blame]
developer24de34b2022-11-28 16:51:20 +08001--- a/drivers/mtd/tests/pagetest.c 2022-11-28 16:08:26.978090509 +0800
2+++ b/drivers/mtd/tests/pagetest.c 2022-11-28 16:10:04.351026850 +0800
3@@ -25,6 +25,10 @@ static int dev = -EINVAL;
4 module_param(dev, int, S_IRUGO);
5 MODULE_PARM_DESC(dev, "MTD device number to use");
6
7+static int count = 10000;
8+module_param(count, int, 0444);
9+MODULE_PARM_DESC(count, "Number of operations to do (default is 10000)");
10+
11 static struct mtd_info *mtd;
12 static unsigned char *twopages;
13 static unsigned char *writebuf;
14@@ -331,7 +335,7 @@ static int __init mtd_pagetest_init(void
15 return -EINVAL;
16 }
17
18- pr_info("MTD device: %d\n", dev);
19+ pr_info("MTD device: %d count:%d\n", dev, count);
20
21 mtd = get_mtd_device(NULL, dev);
22 if (IS_ERR(mtd)) {
23@@ -376,6 +380,7 @@ static int __init mtd_pagetest_init(void
24 if (err)
25 goto out;
26
27+LOOP:
28 /* Erase all eraseblocks */
29 pr_info("erasing whole device\n");
30 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt);
31@@ -435,7 +440,10 @@ static int __init mtd_pagetest_init(void
32 if (err)
33 goto out;
34
35- pr_info("finished with %d errors\n", errcnt);
36+ pr_info("finished with %d errors count:%d\n", errcnt, count);
37+
38+ if (count-- > 0)
39+ goto LOOP;
40 out:
41
42 kfree(bbt);