Lines Matching refs:mtd
63 struct mtd_info *mtd; member
95 struct mtd_info *mtd = cxt->mtd; in mtdoops_erase_block() local
96 u32 start_page_offset = mtd_div_by_eb(offset, mtd) * mtd->erasesize; in mtdoops_erase_block()
98 u32 erase_pages = mtd->erasesize / record_size; in mtdoops_erase_block()
106 erase.mtd = mtd; in mtdoops_erase_block()
109 erase.len = mtd->erasesize; in mtdoops_erase_block()
115 ret = mtd_erase(mtd, &erase); in mtdoops_erase_block()
158 struct mtd_info *mtd = cxt->mtd; in mtdoops_workfunc_erase() local
162 if (!mtd) in mtdoops_workfunc_erase()
165 mod = (cxt->nextpage * record_size) % mtd->erasesize; in mtdoops_workfunc_erase()
167 cxt->nextpage = cxt->nextpage + ((mtd->erasesize - mod) / record_size); in mtdoops_workfunc_erase()
172 while ((ret = mtd_block_isbad(mtd, cxt->nextpage * record_size)) > 0) { in mtdoops_workfunc_erase()
177 cxt->nextpage = cxt->nextpage + (mtd->erasesize / record_size); in mtdoops_workfunc_erase()
180 if (i == cxt->oops_pages / (mtd->erasesize / record_size)) { in mtdoops_workfunc_erase()
201 ret = mtd_block_markbad(mtd, cxt->nextpage * record_size); in mtdoops_workfunc_erase()
212 struct mtd_info *mtd = cxt->mtd; in mtdoops_write() local
223 ret = mtd_panic_write(mtd, cxt->nextpage * record_size, in mtdoops_write()
230 ret = mtd_write(mtd, cxt->nextpage * record_size, in mtdoops_write()
252 struct mtd_info *mtd = cxt->mtd; in find_next_position() local
258 if (mtd_block_isbad(mtd, page * record_size)) in find_next_position()
262 ret = mtd_read(mtd, page * record_size, MTDOOPS_HEADER_SIZE, in find_next_position()
324 static void mtdoops_notify_add(struct mtd_info *mtd) in mtdoops_notify_add() argument
327 u64 mtdoops_pages = div_u64(mtd->size, record_size); in mtdoops_notify_add()
330 if (!strcmp(mtd->name, mtddev)) in mtdoops_notify_add()
331 cxt->mtd_index = mtd->index; in mtdoops_notify_add()
333 if (mtd->index != cxt->mtd_index || cxt->mtd_index < 0) in mtdoops_notify_add()
336 if (mtd->size < mtd->erasesize * 2) { in mtdoops_notify_add()
338 mtd->index); in mtdoops_notify_add()
341 if (mtd->erasesize < record_size) { in mtdoops_notify_add()
343 mtd->index); in mtdoops_notify_add()
346 if (mtd->size > MTDOOPS_MAX_MTD_SIZE) { in mtdoops_notify_add()
348 mtd->index, MTDOOPS_MAX_MTD_SIZE / 1024 / 1024); in mtdoops_notify_add()
370 cxt->mtd = mtd; in mtdoops_notify_add()
371 cxt->oops_pages = (int)mtd->size / record_size; in mtdoops_notify_add()
373 printk(KERN_INFO "mtdoops: Attached to MTD device %d\n", mtd->index); in mtdoops_notify_add()
376 static void mtdoops_notify_remove(struct mtd_info *mtd) in mtdoops_notify_remove() argument
380 if (mtd->index != cxt->mtd_index || cxt->mtd_index < 0) in mtdoops_notify_remove()
386 cxt->mtd = NULL; in mtdoops_notify_remove()