Lines Matching refs:mtd
43 struct mtd_info *mtd; member
62 static int mtdoops_erase_block(struct mtd_info *mtd, int offset) in mtdoops_erase_block() argument
70 erase.mtd = mtd; in mtdoops_erase_block()
73 erase.len = mtd->erasesize; in mtdoops_erase_block()
79 ret = mtd->erase(mtd, &erase); in mtdoops_erase_block()
85 (unsigned long long)erase.addr, (unsigned long long)erase.len, mtd->name); in mtdoops_erase_block()
97 struct mtd_info *mtd = cxt->mtd; in mtdoops_inc_counter() local
109 ret = mtd->read(mtd, cxt->nextpage * OOPS_PAGE_SIZE, 4, in mtdoops_inc_counter()
135 struct mtd_info *mtd = cxt->mtd; in mtdoops_workfunc_erase() local
139 if (!mtd) in mtdoops_workfunc_erase()
142 mod = (cxt->nextpage * OOPS_PAGE_SIZE) % mtd->erasesize; in mtdoops_workfunc_erase()
144 cxt->nextpage = cxt->nextpage + ((mtd->erasesize - mod) / OOPS_PAGE_SIZE); in mtdoops_workfunc_erase()
149 while (mtd->block_isbad) { in mtdoops_workfunc_erase()
150 ret = mtd->block_isbad(mtd, cxt->nextpage * OOPS_PAGE_SIZE); in mtdoops_workfunc_erase()
161 cxt->nextpage = cxt->nextpage + (mtd->erasesize / OOPS_PAGE_SIZE); in mtdoops_workfunc_erase()
164 if (i == (cxt->oops_pages / (mtd->erasesize / OOPS_PAGE_SIZE))) { in mtdoops_workfunc_erase()
171 ret = mtdoops_erase_block(mtd, cxt->nextpage * OOPS_PAGE_SIZE); in mtdoops_workfunc_erase()
179 if (mtd->block_markbad && (ret == -EIO)) { in mtdoops_workfunc_erase()
180 ret = mtd->block_markbad(mtd, cxt->nextpage * OOPS_PAGE_SIZE); in mtdoops_workfunc_erase()
191 struct mtd_info *mtd = cxt->mtd; in mtdoops_write() local
200 ret = mtd->panic_write(mtd, cxt->nextpage * OOPS_PAGE_SIZE, in mtdoops_write()
203 ret = mtd->write(mtd, cxt->nextpage * OOPS_PAGE_SIZE, in mtdoops_write()
226 struct mtd_info *mtd = cxt->mtd; in find_next_position() local
232 ret = mtd->read(mtd, page * OOPS_PAGE_SIZE, 8, &retlen, (u_char *) &count[0]); in find_next_position()
272 static void mtdoops_notify_add(struct mtd_info *mtd) in mtdoops_notify_add() argument
276 if ((mtd->index != cxt->mtd_index) || cxt->mtd_index < 0) in mtdoops_notify_add()
279 if (mtd->size < (mtd->erasesize * 2)) { in mtdoops_notify_add()
281 mtd->index); in mtdoops_notify_add()
285 if (mtd->erasesize < OOPS_PAGE_SIZE) { in mtdoops_notify_add()
287 mtd->index); in mtdoops_notify_add()
291 cxt->mtd = mtd; in mtdoops_notify_add()
292 if (mtd->size > INT_MAX) in mtdoops_notify_add()
295 cxt->oops_pages = (int)mtd->size / OOPS_PAGE_SIZE; in mtdoops_notify_add()
299 printk(KERN_INFO "mtdoops: Attached to MTD device %d\n", mtd->index); in mtdoops_notify_add()
302 static void mtdoops_notify_remove(struct mtd_info *mtd) in mtdoops_notify_remove() argument
306 if ((mtd->index != cxt->mtd_index) || cxt->mtd_index < 0) in mtdoops_notify_remove()
309 cxt->mtd = NULL; in mtdoops_notify_remove()
316 struct mtd_info *mtd = cxt->mtd; in mtdoops_console_sync() local
319 if (!cxt->ready || !mtd || cxt->writecount == 0) in mtdoops_console_sync()
334 if (mtd->panic_write && in_interrupt()) in mtdoops_console_sync()
345 struct mtd_info *mtd = cxt->mtd; in mtdoops_console_write() local
353 if (!cxt->ready || !mtd) in mtdoops_console_write()