blob: 776d990ed11892c62653de51b5defa4c5cd14cda [file] [log] [blame]
From eaa6d1a21a8ea3c68498ef4ff0cf91d109e4d821 Mon Sep 17 00:00:00 2001
From: Sam Shih <sam.shih@mediatek.com>
Date: Fri, 2 Jun 2023 13:06:16 +0800
Subject: [PATCH] [spi-and-storage][999-2338-mtd-tests-fix-pagetest-load.patch]
---
drivers/mtd/tests/pagetest.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/tests/pagetest.c b/drivers/mtd/tests/pagetest.c
index 8eb40b6e6..d1c8a932e 100644
--- a/drivers/mtd/tests/pagetest.c
+++ b/drivers/mtd/tests/pagetest.c
@@ -25,6 +25,10 @@ static int dev = -EINVAL;
module_param(dev, int, S_IRUGO);
MODULE_PARM_DESC(dev, "MTD device number to use");
+static int count = 10000;
+module_param(count, int, 0444);
+MODULE_PARM_DESC(count, "Number of operations to do (default is 10000)");
+
static struct mtd_info *mtd;
static unsigned char *twopages;
static unsigned char *writebuf;
@@ -331,7 +335,7 @@ static int __init mtd_pagetest_init(void)
return -EINVAL;
}
- pr_info("MTD device: %d\n", dev);
+ pr_info("MTD device: %d count:%d\n", dev, count);
mtd = get_mtd_device(NULL, dev);
if (IS_ERR(mtd)) {
@@ -376,6 +380,7 @@ static int __init mtd_pagetest_init(void)
if (err)
goto out;
+LOOP:
/* Erase all eraseblocks */
pr_info("erasing whole device\n");
err = mtdtest_erase_good_eraseblocks(mtd, bbt, 0, ebcnt);
@@ -435,7 +440,10 @@ static int __init mtd_pagetest_init(void)
if (err)
goto out;
- pr_info("finished with %d errors\n", errcnt);
+ pr_info("finished with %d errors count:%d\n", errcnt, count);
+
+ if (count-- > 0)
+ goto LOOP;
out:
kfree(bbt);
--
2.34.1