Lines Matching +full:read +full:- +full:out

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2006-2007 Nokia Corporation
5 * Test sub-page read and write on MTD device.
6 * Author: Adrian Hunter <ext-adrian.hunter@nokia.com>
22 static int dev = -EINVAL;
47 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock()
58 return err ? err : -1; in write_eraseblock()
72 return err ? err : -1; in write_eraseblock()
82 loff_t addr = (loff_t)ebnum * mtd->erasesize; in write_eraseblock2()
85 if (addr + (subpgsize * k) > (loff_t)(ebnum + 1) * mtd->erasesize) in write_eraseblock2()
98 return err ? err : -1; in write_eraseblock2()
119 size_t read; in verify_eraseblock() local
121 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock()
125 err = mtd_read(mtd, addr, subpgsize, &read, readbuf); in verify_eraseblock()
126 if (unlikely(err || read != subpgsize)) { in verify_eraseblock()
127 if (mtd_is_bitflip(err) && read == subpgsize) { in verify_eraseblock()
132 pr_err("error: read failed at %#llx\n", in verify_eraseblock()
134 return err ? err : -1; in verify_eraseblock()
140 pr_info("------------- written----------------\n"); in verify_eraseblock()
142 pr_info("------------- read ------------------\n"); in verify_eraseblock()
144 pr_info("-------------------------------------\n"); in verify_eraseblock()
152 err = mtd_read(mtd, addr, subpgsize, &read, readbuf); in verify_eraseblock()
153 if (unlikely(err || read != subpgsize)) { in verify_eraseblock()
154 if (mtd_is_bitflip(err) && read == subpgsize) { in verify_eraseblock()
159 pr_err("error: read failed at %#llx\n", in verify_eraseblock()
161 return err ? err : -1; in verify_eraseblock()
167 pr_info("------------- written----------------\n"); in verify_eraseblock()
169 pr_info("------------- read ------------------\n"); in verify_eraseblock()
171 pr_info("-------------------------------------\n"); in verify_eraseblock()
180 size_t read; in verify_eraseblock2() local
182 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock2()
185 if (addr + (subpgsize * k) > (loff_t)(ebnum + 1) * mtd->erasesize) in verify_eraseblock2()
189 err = mtd_read(mtd, addr, subpgsize * k, &read, readbuf); in verify_eraseblock2()
190 if (unlikely(err || read != subpgsize * k)) { in verify_eraseblock2()
191 if (mtd_is_bitflip(err) && read == subpgsize * k) { in verify_eraseblock2()
196 pr_err("error: read failed at " in verify_eraseblock2()
198 return err ? err : -1; in verify_eraseblock2()
215 size_t read; in verify_eraseblock_ff() local
217 loff_t addr = (loff_t)ebnum * mtd->erasesize; in verify_eraseblock_ff()
220 for (j = 0; j < mtd->erasesize / subpgsize; ++j) { in verify_eraseblock_ff()
222 err = mtd_read(mtd, addr, subpgsize, &read, readbuf); in verify_eraseblock_ff()
223 if (unlikely(err || read != subpgsize)) { in verify_eraseblock_ff()
224 if (mtd_is_bitflip(err) && read == subpgsize) { in verify_eraseblock_ff()
229 pr_err("error: read failed at " in verify_eraseblock_ff()
231 return err ? err : -1; in verify_eraseblock_ff()
278 pr_info("Please specify a valid mtd-device via module parameter\n"); in mtd_subpagetest_init()
280 return -EINVAL; in mtd_subpagetest_init()
294 goto out; in mtd_subpagetest_init()
297 subpgsize = mtd->writesize >> mtd->subpage_sft; in mtd_subpagetest_init()
298 tmp = mtd->size; in mtd_subpagetest_init()
299 do_div(tmp, mtd->erasesize); in mtd_subpagetest_init()
301 pgcnt = mtd->erasesize / mtd->writesize; in mtd_subpagetest_init()
306 (unsigned long long)mtd->size, mtd->erasesize, in mtd_subpagetest_init()
307 mtd->writesize, subpgsize, ebcnt, pgcnt, mtd->oobsize); in mtd_subpagetest_init()
309 err = -ENOMEM; in mtd_subpagetest_init()
313 goto out; in mtd_subpagetest_init()
316 goto out; in mtd_subpagetest_init()
319 goto out; in mtd_subpagetest_init()
323 goto out; in mtd_subpagetest_init()
327 goto out; in mtd_subpagetest_init()
336 goto out; in mtd_subpagetest_init()
342 goto out; in mtd_subpagetest_init()
353 goto out; in mtd_subpagetest_init()
359 goto out; in mtd_subpagetest_init()
365 goto out; in mtd_subpagetest_init()
369 goto out; in mtd_subpagetest_init()
379 goto out; in mtd_subpagetest_init()
385 goto out; in mtd_subpagetest_init()
397 goto out; in mtd_subpagetest_init()
403 goto out; in mtd_subpagetest_init()
409 goto out; in mtd_subpagetest_init()
413 goto out; in mtd_subpagetest_init()
417 out: in mtd_subpagetest_init()