Lines Matching refs:mtd
44 static struct mtd_info *mtd; variable
94 if (offs >= mtd->erasesize) in do_read()
95 offs -= mtd->erasesize; in do_read()
96 if (offs + len > mtd->erasesize) in do_read()
97 len = mtd->erasesize - offs; in do_read()
99 addr = (loff_t)eb * mtd->erasesize + offs; in do_read()
100 return mtdtest_read(mtd, addr, len, readbuf); in do_read()
109 if (offs >= mtd->erasesize) { in do_write()
110 err = mtdtest_erase_eraseblock(mtd, eb); in do_write()
117 if (offs + len > mtd->erasesize) { in do_write()
119 len = mtd->erasesize - offs; in do_write()
121 err = mtdtest_erase_eraseblock(mtd, eb + 1); in do_write()
127 addr = (loff_t)eb * mtd->erasesize + offs; in do_write()
128 err = mtdtest_write(mtd, addr, len, writebuf); in do_write()
132 while (offs > mtd->erasesize) { in do_write()
133 offsets[eb++] = mtd->erasesize; in do_write()
134 offs -= mtd->erasesize; in do_write()
165 mtd = get_mtd_device(NULL, dev); in mtd_stresstest_init()
166 if (IS_ERR(mtd)) { in mtd_stresstest_init()
167 err = PTR_ERR(mtd); in mtd_stresstest_init()
172 if (mtd->writesize == 1) { in mtd_stresstest_init()
177 pgsize = mtd->writesize; in mtd_stresstest_init()
179 tmp = mtd->size; in mtd_stresstest_init()
180 do_div(tmp, mtd->erasesize); in mtd_stresstest_init()
182 pgcnt = mtd->erasesize / pgsize; in mtd_stresstest_init()
187 (unsigned long long)mtd->size, mtd->erasesize, in mtd_stresstest_init()
188 pgsize, ebcnt, pgcnt, mtd->oobsize); in mtd_stresstest_init()
197 bufsize = mtd->erasesize * 2; in mtd_stresstest_init()
206 offsets[i] = mtd->erasesize; in mtd_stresstest_init()
212 err = mtdtest_scan_for_bad_eraseblocks(mtd, bbt, 0, ebcnt); in mtd_stresstest_init()
237 put_mtd_device(mtd); in mtd_stresstest_init()