File tree Expand file tree Collapse file tree 10 files changed +120
-24
lines changed Expand file tree Collapse file tree 10 files changed +120
-24
lines changed Original file line number Diff line number Diff line change 99#include <linux/slab.h>
1010#include <linux/mtd/nand_ecc.h>
1111
12+ #include "mtd_test.h"
13+
1214/*
1315 * Test the implementation for software ECC
1416 *
@@ -274,6 +276,10 @@ static int nand_ecc_test_run(const size_t size)
274276 }
275277 pr_info ("ok - %s-%zd\n" ,
276278 nand_ecc_test [i ].name , size );
279+
280+ err = mtdtest_relax ();
281+ if (err )
282+ break ;
277283 }
278284error :
279285 kfree (error_data );
Original file line number Diff line number Diff line change 11#include <linux/mtd/mtd.h>
2+ #include <linux/sched.h>
3+
4+ static inline int mtdtest_relax (void )
5+ {
6+ cond_resched ();
7+ if (signal_pending (current )) {
8+ pr_info ("aborting test due to pending signal!\n" );
9+ return - EINTR ;
10+ }
11+
12+ return 0 ;
13+ }
214
315int mtdtest_erase_eraseblock (struct mtd_info * mtd , unsigned int ebnum );
416int mtdtest_scan_for_bad_eraseblocks (struct mtd_info * mtd , unsigned char * bbt ,
Original file line number Diff line number Diff line change @@ -320,6 +320,10 @@ static int overwrite_test(void)
320320 break ;
321321 }
322322
323+ err = mtdtest_relax ();
324+ if (err )
325+ break ;
326+
323327 opno ++ ;
324328 }
325329
Original file line number Diff line number Diff line change @@ -112,7 +112,10 @@ static int write_whole_device(void)
112112 return err ;
113113 if (i % 256 == 0 )
114114 pr_info ("written up to eraseblock %u\n" , i );
115- cond_resched ();
115+
116+ err = mtdtest_relax ();
117+ if (err )
118+ return err ;
116119 }
117120 pr_info ("written %u eraseblocks\n" , i );
118121 return 0 ;
@@ -318,7 +321,10 @@ static int verify_all_eraseblocks(void)
318321 return err ;
319322 if (i % 256 == 0 )
320323 pr_info ("verified up to eraseblock %u\n" , i );
321- cond_resched ();
324+
325+ err = mtdtest_relax ();
326+ if (err )
327+ return err ;
322328 }
323329 pr_info ("verified %u eraseblocks\n" , i );
324330 return 0 ;
@@ -429,7 +435,10 @@ static int __init mtd_oobtest_init(void)
429435 goto out ;
430436 if (i % 256 == 0 )
431437 pr_info ("verified up to eraseblock %u\n" , i );
432- cond_resched ();
438+
439+ err = mtdtest_relax ();
440+ if (err )
441+ goto out ;
433442 }
434443 pr_info ("verified %u eraseblocks\n" , i );
435444
@@ -642,7 +651,11 @@ static int __init mtd_oobtest_init(void)
642651 goto out ;
643652 if (i % 256 == 0 )
644653 pr_info ("written up to eraseblock %u\n" , i );
645- cond_resched ();
654+
655+ err = mtdtest_relax ();
656+ if (err )
657+ goto out ;
658+
646659 addr += mtd -> writesize ;
647660 }
648661 }
@@ -680,7 +693,10 @@ static int __init mtd_oobtest_init(void)
680693 }
681694 if (i % 256 == 0 )
682695 pr_info ("verified up to eraseblock %u\n" , i );
683- cond_resched ();
696+
697+ err = mtdtest_relax ();
698+ if (err )
699+ goto out ;
684700 }
685701 pr_info ("verified %u eraseblocks\n" , i );
686702
Original file line number Diff line number Diff line change @@ -407,7 +407,10 @@ static int __init mtd_pagetest_init(void)
407407 goto out ;
408408 if (i % 256 == 0 )
409409 pr_info ("written up to eraseblock %u\n" , i );
410- cond_resched ();
410+
411+ err = mtdtest_relax ();
412+ if (err )
413+ goto out ;
411414 }
412415 pr_info ("written %u eraseblocks\n" , i );
413416
@@ -422,7 +425,10 @@ static int __init mtd_pagetest_init(void)
422425 goto out ;
423426 if (i % 256 == 0 )
424427 pr_info ("verified up to eraseblock %u\n" , i );
425- cond_resched ();
428+
429+ err = mtdtest_relax ();
430+ if (err )
431+ goto out ;
426432 }
427433 pr_info ("verified %u eraseblocks\n" , i );
428434
Original file line number Diff line number Diff line change @@ -190,7 +190,10 @@ static int __init mtd_readtest_init(void)
190190 if (!err )
191191 err = ret ;
192192 }
193- cond_resched ();
193+
194+ err = mtdtest_relax ();
195+ if (err )
196+ goto out ;
194197 }
195198
196199 if (err )
Original file line number Diff line number Diff line change @@ -269,7 +269,10 @@ static int __init mtd_speedtest_init(void)
269269 err = write_eraseblock (i );
270270 if (err )
271271 goto out ;
272- cond_resched ();
272+
273+ err = mtdtest_relax ();
274+ if (err )
275+ goto out ;
273276 }
274277 stop_timing ();
275278 speed = calc_speed ();
@@ -284,7 +287,10 @@ static int __init mtd_speedtest_init(void)
284287 err = read_eraseblock (i );
285288 if (err )
286289 goto out ;
287- cond_resched ();
290+
291+ err = mtdtest_relax ();
292+ if (err )
293+ goto out ;
288294 }
289295 stop_timing ();
290296 speed = calc_speed ();
@@ -303,7 +309,10 @@ static int __init mtd_speedtest_init(void)
303309 err = write_eraseblock_by_page (i );
304310 if (err )
305311 goto out ;
306- cond_resched ();
312+
313+ err = mtdtest_relax ();
314+ if (err )
315+ goto out ;
307316 }
308317 stop_timing ();
309318 speed = calc_speed ();
@@ -318,7 +327,10 @@ static int __init mtd_speedtest_init(void)
318327 err = read_eraseblock_by_page (i );
319328 if (err )
320329 goto out ;
321- cond_resched ();
330+
331+ err = mtdtest_relax ();
332+ if (err )
333+ goto out ;
322334 }
323335 stop_timing ();
324336 speed = calc_speed ();
@@ -337,7 +349,10 @@ static int __init mtd_speedtest_init(void)
337349 err = write_eraseblock_by_2pages (i );
338350 if (err )
339351 goto out ;
340- cond_resched ();
352+
353+ err = mtdtest_relax ();
354+ if (err )
355+ goto out ;
341356 }
342357 stop_timing ();
343358 speed = calc_speed ();
@@ -352,7 +367,10 @@ static int __init mtd_speedtest_init(void)
352367 err = read_eraseblock_by_2pages (i );
353368 if (err )
354369 goto out ;
355- cond_resched ();
370+
371+ err = mtdtest_relax ();
372+ if (err )
373+ goto out ;
356374 }
357375 stop_timing ();
358376 speed = calc_speed ();
@@ -385,7 +403,11 @@ static int __init mtd_speedtest_init(void)
385403 err = multiblock_erase (i , j );
386404 if (err )
387405 goto out ;
388- cond_resched ();
406+
407+ err = mtdtest_relax ();
408+ if (err )
409+ goto out ;
410+
389411 i += j ;
390412 }
391413 stop_timing ();
Original file line number Diff line number Diff line change @@ -221,7 +221,10 @@ static int __init mtd_stresstest_init(void)
221221 err = do_operation ();
222222 if (err )
223223 goto out ;
224- cond_resched ();
224+
225+ err = mtdtest_relax ();
226+ if (err )
227+ goto out ;
225228 }
226229 pr_info ("finished, %d operations done\n" , op );
227230
Original file line number Diff line number Diff line change @@ -269,7 +269,10 @@ static int verify_all_eraseblocks_ff(void)
269269 return err ;
270270 if (i % 256 == 0 )
271271 pr_info ("verified up to eraseblock %u\n" , i );
272- cond_resched ();
272+
273+ err = mtdtest_relax ();
274+ if (err )
275+ return err ;
273276 }
274277 pr_info ("verified %u eraseblocks\n" , i );
275278 return 0 ;
@@ -346,7 +349,10 @@ static int __init mtd_subpagetest_init(void)
346349 goto out ;
347350 if (i % 256 == 0 )
348351 pr_info ("written up to eraseblock %u\n" , i );
349- cond_resched ();
352+
353+ err = mtdtest_relax ();
354+ if (err )
355+ goto out ;
350356 }
351357 pr_info ("written %u eraseblocks\n" , i );
352358
@@ -360,7 +366,10 @@ static int __init mtd_subpagetest_init(void)
360366 goto out ;
361367 if (i % 256 == 0 )
362368 pr_info ("verified up to eraseblock %u\n" , i );
363- cond_resched ();
369+
370+ err = mtdtest_relax ();
371+ if (err )
372+ goto out ;
364373 }
365374 pr_info ("verified %u eraseblocks\n" , i );
366375
@@ -383,7 +392,10 @@ static int __init mtd_subpagetest_init(void)
383392 goto out ;
384393 if (i % 256 == 0 )
385394 pr_info ("written up to eraseblock %u\n" , i );
386- cond_resched ();
395+
396+ err = mtdtest_relax ();
397+ if (err )
398+ goto out ;
387399 }
388400 pr_info ("written %u eraseblocks\n" , i );
389401
@@ -398,7 +410,10 @@ static int __init mtd_subpagetest_init(void)
398410 goto out ;
399411 if (i % 256 == 0 )
400412 pr_info ("verified up to eraseblock %u\n" , i );
401- cond_resched ();
413+
414+ err = mtdtest_relax ();
415+ if (err )
416+ goto out ;
402417 }
403418 pr_info ("verified %u eraseblocks\n" , i );
404419
Original file line number Diff line number Diff line change @@ -279,7 +279,10 @@ static int __init tort_init(void)
279279 " for 0xFF... pattern\n" );
280280 goto out ;
281281 }
282- cond_resched ();
282+
283+ err = mtdtest_relax ();
284+ if (err )
285+ goto out ;
283286 }
284287 }
285288
@@ -294,7 +297,10 @@ static int __init tort_init(void)
294297 err = write_pattern (i , patt );
295298 if (err )
296299 goto out ;
297- cond_resched ();
300+
301+ err = mtdtest_relax ();
302+ if (err )
303+ goto out ;
298304 }
299305
300306 /* Verify what we wrote */
@@ -314,7 +320,10 @@ static int __init tort_init(void)
314320 "0x55AA55..." : "0xAA55AA..." );
315321 goto out ;
316322 }
317- cond_resched ();
323+
324+ err = mtdtest_relax ();
325+ if (err )
326+ goto out ;
318327 }
319328 }
320329
You can’t perform that action at this time.
0 commit comments