From 2a6a28e7922c07c116ba8f2aa3682c03ef8be678 Mon Sep 17 00:00:00 2001 From: Richard Weinberger Date: Sun, 29 Mar 2015 21:52:06 +0200 Subject: mtd: Make MTD tests cancelable I always go nuts when I start an MTD test on a slow device and have to wait forever until it finishes. From the debug output I already know what the issue is but I have to wait or reset the board hard. Resetting is often not an option (remote access, you don't want lose the current state, etc...). The solution is easy, check for pending signals at key positions in the code. Using that one can even stop a test by pressing CTRL-C as insmod/modprobe have SIGINT pending. Signed-off-by: Richard Weinberger Signed-off-by: Brian Norris --- drivers/mtd/tests/stresstest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'drivers/mtd/tests/stresstest.c') diff --git a/drivers/mtd/tests/stresstest.c b/drivers/mtd/tests/stresstest.c index d90c1c01dac6..e509f8aa9a7e 100644 --- a/drivers/mtd/tests/stresstest.c +++ b/drivers/mtd/tests/stresstest.c @@ -221,7 +221,10 @@ static int __init mtd_stresstest_init(void) err = do_operation(); if (err) goto out; - cond_resched(); + + err = mtdtest_relax(); + if (err) + goto out; } pr_info("finished, %d operations done\n", op); -- cgit v1.2.3