Lines Matching refs:mtd

22 #include <linux/mtd/mtd.h>
58 struct mtd_info *mtd;
85 struct mtd_info *mtd = cxt->mtd;
86 u32 start_page_offset = mtd_div_by_eb(offset, mtd) * mtd->erasesize;
88 u32 erase_pages = mtd->erasesize / record_size;
94 erase.len = mtd->erasesize;
96 ret = mtd_erase(mtd, &erase);
113 struct mtd_info *mtd = cxt->mtd;
117 if (!mtd)
120 mod = (cxt->nextpage * record_size) % mtd->erasesize;
122 cxt->nextpage = cxt->nextpage + ((mtd->erasesize - mod) / record_size);
127 while ((ret = mtd_block_isbad(mtd, cxt->nextpage * record_size)) > 0) {
132 cxt->nextpage = cxt->nextpage + (mtd->erasesize / record_size);
135 if (i == cxt->oops_pages / (mtd->erasesize / record_size)) {
156 ret = mtd_block_markbad(mtd, cxt->nextpage * record_size);
201 struct mtd_info *mtd = cxt->mtd;
216 ret = mtd_panic_write(mtd, cxt->nextpage * record_size,
223 ret = mtd_write(mtd, cxt->nextpage * record_size,
247 struct mtd_info *mtd = cxt->mtd;
254 if (mtd_block_isbad(mtd, page * record_size))
258 ret = mtd_read(mtd, page * record_size, sizeof(hdr),
329 static void mtdoops_notify_add(struct mtd_info *mtd)
332 u64 mtdoops_pages = div_u64(mtd->size, record_size);
335 if (!strcmp(mtd->name, mtddev))
336 cxt->mtd_index = mtd->index;
338 if (mtd->index != cxt->mtd_index || cxt->mtd_index < 0)
341 if (mtd->size < mtd->erasesize * 2) {
343 mtd->index);
346 if (mtd->erasesize < record_size) {
348 mtd->index);
351 if (mtd->size > MTDOOPS_MAX_MTD_SIZE) {
352 pr_err("mtd%d is too large (limit is %d MiB)\n",
353 mtd->index, MTDOOPS_MAX_MTD_SIZE / 1024 / 1024);
377 cxt->mtd = mtd;
378 cxt->oops_pages = (int)mtd->size / record_size;
380 pr_info("Attached to MTD device %d\n", mtd->index);
383 static void mtdoops_notify_remove(struct mtd_info *mtd)
387 if (mtd->index != cxt->mtd_index || cxt->mtd_index < 0)
393 cxt->mtd = NULL;
411 pr_err("mtd device (mtddev=name/number) must be supplied\n");