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 9
9
#include <linux/slab.h>
10
10
#include <linux/mtd/nand_ecc.h>
11
11
12
+ #include "mtd_test.h"
13
+
12
14
/*
13
15
* Test the implementation for software ECC
14
16
*
@@ -274,6 +276,10 @@ static int nand_ecc_test_run(const size_t size)
274
276
}
275
277
pr_info ("ok - %s-%zd\n" ,
276
278
nand_ecc_test [i ].name , size );
279
+
280
+ err = mtdtest_relax ();
281
+ if (err )
282
+ break ;
277
283
}
278
284
error :
279
285
kfree (error_data );
Original file line number Diff line number Diff line change 1
1
#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
+ }
2
14
3
15
int mtdtest_erase_eraseblock (struct mtd_info * mtd , unsigned int ebnum );
4
16
int 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)
320
320
break ;
321
321
}
322
322
323
+ err = mtdtest_relax ();
324
+ if (err )
325
+ break ;
326
+
323
327
opno ++ ;
324
328
}
325
329
Original file line number Diff line number Diff line change @@ -112,7 +112,10 @@ static int write_whole_device(void)
112
112
return err ;
113
113
if (i % 256 == 0 )
114
114
pr_info ("written up to eraseblock %u\n" , i );
115
- cond_resched ();
115
+
116
+ err = mtdtest_relax ();
117
+ if (err )
118
+ return err ;
116
119
}
117
120
pr_info ("written %u eraseblocks\n" , i );
118
121
return 0 ;
@@ -318,7 +321,10 @@ static int verify_all_eraseblocks(void)
318
321
return err ;
319
322
if (i % 256 == 0 )
320
323
pr_info ("verified up to eraseblock %u\n" , i );
321
- cond_resched ();
324
+
325
+ err = mtdtest_relax ();
326
+ if (err )
327
+ return err ;
322
328
}
323
329
pr_info ("verified %u eraseblocks\n" , i );
324
330
return 0 ;
@@ -429,7 +435,10 @@ static int __init mtd_oobtest_init(void)
429
435
goto out ;
430
436
if (i % 256 == 0 )
431
437
pr_info ("verified up to eraseblock %u\n" , i );
432
- cond_resched ();
438
+
439
+ err = mtdtest_relax ();
440
+ if (err )
441
+ goto out ;
433
442
}
434
443
pr_info ("verified %u eraseblocks\n" , i );
435
444
@@ -642,7 +651,11 @@ static int __init mtd_oobtest_init(void)
642
651
goto out ;
643
652
if (i % 256 == 0 )
644
653
pr_info ("written up to eraseblock %u\n" , i );
645
- cond_resched ();
654
+
655
+ err = mtdtest_relax ();
656
+ if (err )
657
+ goto out ;
658
+
646
659
addr += mtd -> writesize ;
647
660
}
648
661
}
@@ -680,7 +693,10 @@ static int __init mtd_oobtest_init(void)
680
693
}
681
694
if (i % 256 == 0 )
682
695
pr_info ("verified up to eraseblock %u\n" , i );
683
- cond_resched ();
696
+
697
+ err = mtdtest_relax ();
698
+ if (err )
699
+ goto out ;
684
700
}
685
701
pr_info ("verified %u eraseblocks\n" , i );
686
702
Original file line number Diff line number Diff line change @@ -407,7 +407,10 @@ static int __init mtd_pagetest_init(void)
407
407
goto out ;
408
408
if (i % 256 == 0 )
409
409
pr_info ("written up to eraseblock %u\n" , i );
410
- cond_resched ();
410
+
411
+ err = mtdtest_relax ();
412
+ if (err )
413
+ goto out ;
411
414
}
412
415
pr_info ("written %u eraseblocks\n" , i );
413
416
@@ -422,7 +425,10 @@ static int __init mtd_pagetest_init(void)
422
425
goto out ;
423
426
if (i % 256 == 0 )
424
427
pr_info ("verified up to eraseblock %u\n" , i );
425
- cond_resched ();
428
+
429
+ err = mtdtest_relax ();
430
+ if (err )
431
+ goto out ;
426
432
}
427
433
pr_info ("verified %u eraseblocks\n" , i );
428
434
Original file line number Diff line number Diff line change @@ -190,7 +190,10 @@ static int __init mtd_readtest_init(void)
190
190
if (!err )
191
191
err = ret ;
192
192
}
193
- cond_resched ();
193
+
194
+ err = mtdtest_relax ();
195
+ if (err )
196
+ goto out ;
194
197
}
195
198
196
199
if (err )
Original file line number Diff line number Diff line change @@ -269,7 +269,10 @@ static int __init mtd_speedtest_init(void)
269
269
err = write_eraseblock (i );
270
270
if (err )
271
271
goto out ;
272
- cond_resched ();
272
+
273
+ err = mtdtest_relax ();
274
+ if (err )
275
+ goto out ;
273
276
}
274
277
stop_timing ();
275
278
speed = calc_speed ();
@@ -284,7 +287,10 @@ static int __init mtd_speedtest_init(void)
284
287
err = read_eraseblock (i );
285
288
if (err )
286
289
goto out ;
287
- cond_resched ();
290
+
291
+ err = mtdtest_relax ();
292
+ if (err )
293
+ goto out ;
288
294
}
289
295
stop_timing ();
290
296
speed = calc_speed ();
@@ -303,7 +309,10 @@ static int __init mtd_speedtest_init(void)
303
309
err = write_eraseblock_by_page (i );
304
310
if (err )
305
311
goto out ;
306
- cond_resched ();
312
+
313
+ err = mtdtest_relax ();
314
+ if (err )
315
+ goto out ;
307
316
}
308
317
stop_timing ();
309
318
speed = calc_speed ();
@@ -318,7 +327,10 @@ static int __init mtd_speedtest_init(void)
318
327
err = read_eraseblock_by_page (i );
319
328
if (err )
320
329
goto out ;
321
- cond_resched ();
330
+
331
+ err = mtdtest_relax ();
332
+ if (err )
333
+ goto out ;
322
334
}
323
335
stop_timing ();
324
336
speed = calc_speed ();
@@ -337,7 +349,10 @@ static int __init mtd_speedtest_init(void)
337
349
err = write_eraseblock_by_2pages (i );
338
350
if (err )
339
351
goto out ;
340
- cond_resched ();
352
+
353
+ err = mtdtest_relax ();
354
+ if (err )
355
+ goto out ;
341
356
}
342
357
stop_timing ();
343
358
speed = calc_speed ();
@@ -352,7 +367,10 @@ static int __init mtd_speedtest_init(void)
352
367
err = read_eraseblock_by_2pages (i );
353
368
if (err )
354
369
goto out ;
355
- cond_resched ();
370
+
371
+ err = mtdtest_relax ();
372
+ if (err )
373
+ goto out ;
356
374
}
357
375
stop_timing ();
358
376
speed = calc_speed ();
@@ -385,7 +403,11 @@ static int __init mtd_speedtest_init(void)
385
403
err = multiblock_erase (i , j );
386
404
if (err )
387
405
goto out ;
388
- cond_resched ();
406
+
407
+ err = mtdtest_relax ();
408
+ if (err )
409
+ goto out ;
410
+
389
411
i += j ;
390
412
}
391
413
stop_timing ();
Original file line number Diff line number Diff line change @@ -221,7 +221,10 @@ static int __init mtd_stresstest_init(void)
221
221
err = do_operation ();
222
222
if (err )
223
223
goto out ;
224
- cond_resched ();
224
+
225
+ err = mtdtest_relax ();
226
+ if (err )
227
+ goto out ;
225
228
}
226
229
pr_info ("finished, %d operations done\n" , op );
227
230
Original file line number Diff line number Diff line change @@ -269,7 +269,10 @@ static int verify_all_eraseblocks_ff(void)
269
269
return err ;
270
270
if (i % 256 == 0 )
271
271
pr_info ("verified up to eraseblock %u\n" , i );
272
- cond_resched ();
272
+
273
+ err = mtdtest_relax ();
274
+ if (err )
275
+ return err ;
273
276
}
274
277
pr_info ("verified %u eraseblocks\n" , i );
275
278
return 0 ;
@@ -346,7 +349,10 @@ static int __init mtd_subpagetest_init(void)
346
349
goto out ;
347
350
if (i % 256 == 0 )
348
351
pr_info ("written up to eraseblock %u\n" , i );
349
- cond_resched ();
352
+
353
+ err = mtdtest_relax ();
354
+ if (err )
355
+ goto out ;
350
356
}
351
357
pr_info ("written %u eraseblocks\n" , i );
352
358
@@ -360,7 +366,10 @@ static int __init mtd_subpagetest_init(void)
360
366
goto out ;
361
367
if (i % 256 == 0 )
362
368
pr_info ("verified up to eraseblock %u\n" , i );
363
- cond_resched ();
369
+
370
+ err = mtdtest_relax ();
371
+ if (err )
372
+ goto out ;
364
373
}
365
374
pr_info ("verified %u eraseblocks\n" , i );
366
375
@@ -383,7 +392,10 @@ static int __init mtd_subpagetest_init(void)
383
392
goto out ;
384
393
if (i % 256 == 0 )
385
394
pr_info ("written up to eraseblock %u\n" , i );
386
- cond_resched ();
395
+
396
+ err = mtdtest_relax ();
397
+ if (err )
398
+ goto out ;
387
399
}
388
400
pr_info ("written %u eraseblocks\n" , i );
389
401
@@ -398,7 +410,10 @@ static int __init mtd_subpagetest_init(void)
398
410
goto out ;
399
411
if (i % 256 == 0 )
400
412
pr_info ("verified up to eraseblock %u\n" , i );
401
- cond_resched ();
413
+
414
+ err = mtdtest_relax ();
415
+ if (err )
416
+ goto out ;
402
417
}
403
418
pr_info ("verified %u eraseblocks\n" , i );
404
419
Original file line number Diff line number Diff line change @@ -279,7 +279,10 @@ static int __init tort_init(void)
279
279
" for 0xFF... pattern\n" );
280
280
goto out ;
281
281
}
282
- cond_resched ();
282
+
283
+ err = mtdtest_relax ();
284
+ if (err )
285
+ goto out ;
283
286
}
284
287
}
285
288
@@ -294,7 +297,10 @@ static int __init tort_init(void)
294
297
err = write_pattern (i , patt );
295
298
if (err )
296
299
goto out ;
297
- cond_resched ();
300
+
301
+ err = mtdtest_relax ();
302
+ if (err )
303
+ goto out ;
298
304
}
299
305
300
306
/* Verify what we wrote */
@@ -314,7 +320,10 @@ static int __init tort_init(void)
314
320
"0x55AA55..." : "0xAA55AA..." );
315
321
goto out ;
316
322
}
317
- cond_resched ();
323
+
324
+ err = mtdtest_relax ();
325
+ if (err )
326
+ goto out ;
318
327
}
319
328
}
320
329
You can’t perform that action at this time.
0 commit comments