diff options
Diffstat (limited to 'drivers/mtd/tests/mtd_subpagetest.c')
-rw-r--r-- | drivers/mtd/tests/mtd_subpagetest.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/drivers/mtd/tests/mtd_subpagetest.c b/drivers/mtd/tests/mtd_subpagetest.c index 1a05bfac4ee..9667bf53528 100644 --- a/drivers/mtd/tests/mtd_subpagetest.c +++ b/drivers/mtd/tests/mtd_subpagetest.c @@ -80,7 +80,7 @@ static int erase_eraseblock(int ebnum) ei.addr = addr; ei.len = mtd->erasesize; - err = mtd->erase(mtd, &ei); + err = mtd_erase(mtd, &ei); if (err) { printk(PRINT_PREF "error %d while erasing EB %d\n", err, ebnum); return err; @@ -115,12 +115,12 @@ static int erase_whole_device(void) static int write_eraseblock(int ebnum) { - size_t written = 0; + size_t written; int err = 0; loff_t addr = ebnum * mtd->erasesize; set_random_data(writebuf, subpgsize); - err = mtd->write(mtd, addr, subpgsize, &written, writebuf); + err = mtd_write(mtd, addr, subpgsize, &written, writebuf); if (unlikely(err || written != subpgsize)) { printk(PRINT_PREF "error: write failed at %#llx\n", (long long)addr); @@ -134,7 +134,7 @@ static int write_eraseblock(int ebnum) addr += subpgsize; set_random_data(writebuf, subpgsize); - err = mtd->write(mtd, addr, subpgsize, &written, writebuf); + err = mtd_write(mtd, addr, subpgsize, &written, writebuf); if (unlikely(err || written != subpgsize)) { printk(PRINT_PREF "error: write failed at %#llx\n", (long long)addr); @@ -150,7 +150,7 @@ static int write_eraseblock(int ebnum) static int write_eraseblock2(int ebnum) { - size_t written = 0; + size_t written; int err = 0, k; loff_t addr = ebnum * mtd->erasesize; @@ -158,7 +158,7 @@ static int write_eraseblock2(int ebnum) if (addr + (subpgsize * k) > (ebnum + 1) * mtd->erasesize) break; set_random_data(writebuf, subpgsize * k); - err = mtd->write(mtd, addr, subpgsize * k, &written, writebuf); + err = mtd_write(mtd, addr, subpgsize * k, &written, writebuf); if (unlikely(err || written != subpgsize * k)) { printk(PRINT_PREF "error: write failed at %#llx\n", (long long)addr); @@ -189,14 +189,13 @@ static void print_subpage(unsigned char *p) static int verify_eraseblock(int ebnum) { - size_t read = 0; + size_t read; int err = 0; loff_t addr = ebnum * mtd->erasesize; set_random_data(writebuf, subpgsize); clear_data(readbuf, subpgsize); - read = 0; - err = mtd->read(mtd, addr, subpgsize, &read, readbuf); + err = mtd_read(mtd, addr, subpgsize, &read, readbuf); if (unlikely(err || read != subpgsize)) { if (mtd_is_bitflip(err) && read == subpgsize) { printk(PRINT_PREF "ECC correction at %#llx\n", @@ -223,8 +222,7 @@ static int verify_eraseblock(int ebnum) set_random_data(writebuf, subpgsize); clear_data(readbuf, subpgsize); - read = 0; - err = mtd->read(mtd, addr, subpgsize, &read, readbuf); + err = mtd_read(mtd, addr, subpgsize, &read, readbuf); if (unlikely(err || read != subpgsize)) { if (mtd_is_bitflip(err) && read == subpgsize) { printk(PRINT_PREF "ECC correction at %#llx\n", @@ -252,7 +250,7 @@ static int verify_eraseblock(int ebnum) static int verify_eraseblock2(int ebnum) { - size_t read = 0; + size_t read; int err = 0, k; loff_t addr = ebnum * mtd->erasesize; @@ -261,8 +259,7 @@ static int verify_eraseblock2(int ebnum) break; set_random_data(writebuf, subpgsize * k); clear_data(readbuf, subpgsize * k); - read = 0; - err = mtd->read(mtd, addr, subpgsize * k, &read, readbuf); + err = mtd_read(mtd, addr, subpgsize * k, &read, readbuf); if (unlikely(err || read != subpgsize * k)) { if (mtd_is_bitflip(err) && read == subpgsize * k) { printk(PRINT_PREF "ECC correction at %#llx\n", @@ -288,15 +285,14 @@ static int verify_eraseblock2(int ebnum) static int verify_eraseblock_ff(int ebnum) { uint32_t j; - size_t read = 0; + size_t read; int err = 0; loff_t addr = ebnum * mtd->erasesize; memset(writebuf, 0xff, subpgsize); for (j = 0; j < mtd->erasesize / subpgsize; ++j) { clear_data(readbuf, subpgsize); - read = 0; - err = mtd->read(mtd, addr, subpgsize, &read, readbuf); + err = mtd_read(mtd, addr, subpgsize, &read, readbuf); if (unlikely(err || read != subpgsize)) { if (mtd_is_bitflip(err) && read == subpgsize) { printk(PRINT_PREF "ECC correction at %#llx\n", @@ -344,7 +340,7 @@ static int is_block_bad(int ebnum) loff_t addr = ebnum * mtd->erasesize; int ret; - ret = mtd->block_isbad(mtd, addr); + ret = mtd_block_isbad(mtd, addr); if (ret) printk(PRINT_PREF "block %d is bad\n", ebnum); return ret; |