blob: 776d990ed11892c62653de51b5defa4c5cd14cda [file] [log] [blame]
developer5d148cb2023-06-02 13:08:11 +08001From eaa6d1a21a8ea3c68498ef4ff0cf91d109e4d821 Mon Sep 17 00:00:00 2001
2From: Sam Shih <sam.shih@mediatek.com>
3Date: Fri, 2 Jun 2023 13:06:16 +0800
4Subject: [PATCH] [spi-and-storage][999-2338-mtd-tests-fix-pagetest-load.patch]
5
6---
7 drivers/mtd/tests/pagetest.c | 12 ++++++++++--
8 1 file changed, 10 insertions(+), 2 deletions(-)
9
10diff --git a/drivers/mtd/tests/pagetest.c b/drivers/mtd/tests/pagetest.c
11index 8eb40b6e6..d1c8a932e 100644
12--- a/drivers/mtd/tests/pagetest.c
13+++ b/drivers/mtd/tests/pagetest.c
14@@ -25,6 +25,10 @@ static int dev = -EINVAL;
15 module_param(dev, int, S_IRUGO);
16 MODULE_PARM_DESC(dev, "MTD device number to use");
17
18+static int count = 10000;
19+module_param(count, int, 0444);
20+MODULE_PARM_DESC(count, "Number of operations to do (default is 10000)");
21+
22 static struct mtd_info *mtd;
23 static unsigned char *twopages;
24 static unsigned char *writebuf;
25@@ -331,7 +335,7 @@ static int __init mtd_pagetest_init(void)
26 return -EINVAL;
27 }
28
29- pr_info("MTD device: %d\n", dev);
30+ pr_info("MTD device: %d count:%d\n", dev, count);
31
32 mtd = get_mtd_device(NULL, dev);
33 if (IS_ERR(mtd)) {
34@@ -376,6 +380,7 @@ static int __init mtd_pagetest_init(void)
35 if (err)
36 goto out;
37
38+LOOP:
39 /* Erase all eraseblocks */
40 pr_info("erasing whole device\n");
41 err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt);
42@@ -435,7 +440,10 @@ static int __init mtd_pagetest_init(void)
43 if (err)
44 goto out;
45
46- pr_info("finished with %d errors\n", errcnt);
47+ pr_info("finished with %d errors count:%d\n", errcnt, count);
48+
49+ if (count-- > 0)
50+ goto LOOP;
51 out:
52
53 kfree(bbt);
54--
552.34.1
56