diff options
Diffstat (limited to 'drivers/mtd/tests/mtd_oobtest.c')
-rw-r--r-- | drivers/mtd/tests/mtd_oobtest.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/drivers/mtd/tests/mtd_oobtest.c b/drivers/mtd/tests/mtd_oobtest.c index dec92ae6111a..933f7e5f32d3 100644 --- a/drivers/mtd/tests/mtd_oobtest.c +++ b/drivers/mtd/tests/mtd_oobtest.c | |||
@@ -30,7 +30,7 @@ | |||
30 | 30 | ||
31 | #define PRINT_PREF KERN_INFO "mtd_oobtest: " | 31 | #define PRINT_PREF KERN_INFO "mtd_oobtest: " |
32 | 32 | ||
33 | static int dev; | 33 | static int dev = -EINVAL; |
34 | module_param(dev, int, S_IRUGO); | 34 | module_param(dev, int, S_IRUGO); |
35 | MODULE_PARM_DESC(dev, "MTD device number to use"); | 35 | MODULE_PARM_DESC(dev, "MTD device number to use"); |
36 | 36 | ||
@@ -131,7 +131,7 @@ static int write_eraseblock(int ebnum) | |||
131 | 131 | ||
132 | for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { | 132 | for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { |
133 | set_random_data(writebuf, use_len); | 133 | set_random_data(writebuf, use_len); |
134 | ops.mode = MTD_OOB_AUTO; | 134 | ops.mode = MTD_OPS_AUTO_OOB; |
135 | ops.len = 0; | 135 | ops.len = 0; |
136 | ops.retlen = 0; | 136 | ops.retlen = 0; |
137 | ops.ooblen = use_len; | 137 | ops.ooblen = use_len; |
@@ -184,7 +184,7 @@ static int verify_eraseblock(int ebnum) | |||
184 | 184 | ||
185 | for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { | 185 | for (i = 0; i < pgcnt; ++i, addr += mtd->writesize) { |
186 | set_random_data(writebuf, use_len); | 186 | set_random_data(writebuf, use_len); |
187 | ops.mode = MTD_OOB_AUTO; | 187 | ops.mode = MTD_OPS_AUTO_OOB; |
188 | ops.len = 0; | 188 | ops.len = 0; |
189 | ops.retlen = 0; | 189 | ops.retlen = 0; |
190 | ops.ooblen = use_len; | 190 | ops.ooblen = use_len; |
@@ -211,7 +211,7 @@ static int verify_eraseblock(int ebnum) | |||
211 | if (use_offset != 0 || use_len < mtd->ecclayout->oobavail) { | 211 | if (use_offset != 0 || use_len < mtd->ecclayout->oobavail) { |
212 | int k; | 212 | int k; |
213 | 213 | ||
214 | ops.mode = MTD_OOB_AUTO; | 214 | ops.mode = MTD_OPS_AUTO_OOB; |
215 | ops.len = 0; | 215 | ops.len = 0; |
216 | ops.retlen = 0; | 216 | ops.retlen = 0; |
217 | ops.ooblen = mtd->ecclayout->oobavail; | 217 | ops.ooblen = mtd->ecclayout->oobavail; |
@@ -276,7 +276,7 @@ static int verify_eraseblock_in_one_go(int ebnum) | |||
276 | size_t len = mtd->ecclayout->oobavail * pgcnt; | 276 | size_t len = mtd->ecclayout->oobavail * pgcnt; |
277 | 277 | ||
278 | set_random_data(writebuf, len); | 278 | set_random_data(writebuf, len); |
279 | ops.mode = MTD_OOB_AUTO; | 279 | ops.mode = MTD_OPS_AUTO_OOB; |
280 | ops.len = 0; | 280 | ops.len = 0; |
281 | ops.retlen = 0; | 281 | ops.retlen = 0; |
282 | ops.ooblen = len; | 282 | ops.ooblen = len; |
@@ -366,6 +366,13 @@ static int __init mtd_oobtest_init(void) | |||
366 | 366 | ||
367 | printk(KERN_INFO "\n"); | 367 | printk(KERN_INFO "\n"); |
368 | printk(KERN_INFO "=================================================\n"); | 368 | printk(KERN_INFO "=================================================\n"); |
369 | |||
370 | if (dev < 0) { | ||
371 | printk(PRINT_PREF "Please specify a valid mtd-device via module paramter\n"); | ||
372 | printk(KERN_CRIT "CAREFUL: This test wipes all data on the specified MTD device!\n"); | ||
373 | return -EINVAL; | ||
374 | } | ||
375 | |||
369 | printk(PRINT_PREF "MTD device: %d\n", dev); | 376 | printk(PRINT_PREF "MTD device: %d\n", dev); |
370 | 377 | ||
371 | mtd = get_mtd_device(NULL, dev); | 378 | mtd = get_mtd_device(NULL, dev); |
@@ -507,7 +514,7 @@ static int __init mtd_oobtest_init(void) | |||
507 | addr0 += mtd->erasesize; | 514 | addr0 += mtd->erasesize; |
508 | 515 | ||
509 | /* Attempt to write off end of OOB */ | 516 | /* Attempt to write off end of OOB */ |
510 | ops.mode = MTD_OOB_AUTO; | 517 | ops.mode = MTD_OPS_AUTO_OOB; |
511 | ops.len = 0; | 518 | ops.len = 0; |
512 | ops.retlen = 0; | 519 | ops.retlen = 0; |
513 | ops.ooblen = 1; | 520 | ops.ooblen = 1; |
@@ -527,7 +534,7 @@ static int __init mtd_oobtest_init(void) | |||
527 | } | 534 | } |
528 | 535 | ||
529 | /* Attempt to read off end of OOB */ | 536 | /* Attempt to read off end of OOB */ |
530 | ops.mode = MTD_OOB_AUTO; | 537 | ops.mode = MTD_OPS_AUTO_OOB; |
531 | ops.len = 0; | 538 | ops.len = 0; |
532 | ops.retlen = 0; | 539 | ops.retlen = 0; |
533 | ops.ooblen = 1; | 540 | ops.ooblen = 1; |
@@ -551,7 +558,7 @@ static int __init mtd_oobtest_init(void) | |||
551 | "block is bad\n"); | 558 | "block is bad\n"); |
552 | else { | 559 | else { |
553 | /* Attempt to write off end of device */ | 560 | /* Attempt to write off end of device */ |
554 | ops.mode = MTD_OOB_AUTO; | 561 | ops.mode = MTD_OPS_AUTO_OOB; |
555 | ops.len = 0; | 562 | ops.len = 0; |
556 | ops.retlen = 0; | 563 | ops.retlen = 0; |
557 | ops.ooblen = mtd->ecclayout->oobavail + 1; | 564 | ops.ooblen = mtd->ecclayout->oobavail + 1; |
@@ -571,7 +578,7 @@ static int __init mtd_oobtest_init(void) | |||
571 | } | 578 | } |
572 | 579 | ||
573 | /* Attempt to read off end of device */ | 580 | /* Attempt to read off end of device */ |
574 | ops.mode = MTD_OOB_AUTO; | 581 | ops.mode = MTD_OPS_AUTO_OOB; |
575 | ops.len = 0; | 582 | ops.len = 0; |
576 | ops.retlen = 0; | 583 | ops.retlen = 0; |
577 | ops.ooblen = mtd->ecclayout->oobavail + 1; | 584 | ops.ooblen = mtd->ecclayout->oobavail + 1; |
@@ -595,7 +602,7 @@ static int __init mtd_oobtest_init(void) | |||
595 | goto out; | 602 | goto out; |
596 | 603 | ||
597 | /* Attempt to write off end of device */ | 604 | /* Attempt to write off end of device */ |
598 | ops.mode = MTD_OOB_AUTO; | 605 | ops.mode = MTD_OPS_AUTO_OOB; |
599 | ops.len = 0; | 606 | ops.len = 0; |
600 | ops.retlen = 0; | 607 | ops.retlen = 0; |
601 | ops.ooblen = mtd->ecclayout->oobavail; | 608 | ops.ooblen = mtd->ecclayout->oobavail; |
@@ -615,7 +622,7 @@ static int __init mtd_oobtest_init(void) | |||
615 | } | 622 | } |
616 | 623 | ||
617 | /* Attempt to read off end of device */ | 624 | /* Attempt to read off end of device */ |
618 | ops.mode = MTD_OOB_AUTO; | 625 | ops.mode = MTD_OPS_AUTO_OOB; |
619 | ops.len = 0; | 626 | ops.len = 0; |
620 | ops.retlen = 0; | 627 | ops.retlen = 0; |
621 | ops.ooblen = mtd->ecclayout->oobavail; | 628 | ops.ooblen = mtd->ecclayout->oobavail; |
@@ -655,7 +662,7 @@ static int __init mtd_oobtest_init(void) | |||
655 | addr = (i + 1) * mtd->erasesize - mtd->writesize; | 662 | addr = (i + 1) * mtd->erasesize - mtd->writesize; |
656 | for (pg = 0; pg < cnt; ++pg) { | 663 | for (pg = 0; pg < cnt; ++pg) { |
657 | set_random_data(writebuf, sz); | 664 | set_random_data(writebuf, sz); |
658 | ops.mode = MTD_OOB_AUTO; | 665 | ops.mode = MTD_OPS_AUTO_OOB; |
659 | ops.len = 0; | 666 | ops.len = 0; |
660 | ops.retlen = 0; | 667 | ops.retlen = 0; |
661 | ops.ooblen = sz; | 668 | ops.ooblen = sz; |
@@ -683,7 +690,7 @@ static int __init mtd_oobtest_init(void) | |||
683 | continue; | 690 | continue; |
684 | set_random_data(writebuf, mtd->ecclayout->oobavail * 2); | 691 | set_random_data(writebuf, mtd->ecclayout->oobavail * 2); |
685 | addr = (i + 1) * mtd->erasesize - mtd->writesize; | 692 | addr = (i + 1) * mtd->erasesize - mtd->writesize; |
686 | ops.mode = MTD_OOB_AUTO; | 693 | ops.mode = MTD_OPS_AUTO_OOB; |
687 | ops.len = 0; | 694 | ops.len = 0; |
688 | ops.retlen = 0; | 695 | ops.retlen = 0; |
689 | ops.ooblen = mtd->ecclayout->oobavail * 2; | 696 | ops.ooblen = mtd->ecclayout->oobavail * 2; |