• Home
  • Raw
  • Download

Lines Matching refs:mtd

24 static void mtd_notify_add(struct mtd_info* mtd)  in mtd_notify_add()  argument
26 if (!mtd) in mtd_notify_add()
29 device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2), in mtd_notify_add()
30 NULL, "mtd%d", mtd->index); in mtd_notify_add()
32 device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1), in mtd_notify_add()
33 NULL, "mtd%dro", mtd->index); in mtd_notify_add()
36 static void mtd_notify_remove(struct mtd_info* mtd) in mtd_notify_remove() argument
38 if (!mtd) in mtd_notify_remove()
41 device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2)); in mtd_notify_remove()
42 device_destroy(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1)); in mtd_notify_remove()
55 struct mtd_info *mtd; member
62 struct mtd_info *mtd = mfi->mtd; in mtd_lseek() local
71 offset += mtd->size; in mtd_lseek()
77 if (offset >= 0 && offset <= mtd->size) in mtd_lseek()
90 struct mtd_info *mtd; in mtd_open() local
103 mtd = get_mtd_device(NULL, devnum); in mtd_open()
105 if (IS_ERR(mtd)) { in mtd_open()
106 ret = PTR_ERR(mtd); in mtd_open()
110 if (MTD_ABSENT == mtd->type) { in mtd_open()
111 put_mtd_device(mtd); in mtd_open()
117 if ((file->f_mode & FMODE_WRITE) && !(mtd->flags & MTD_WRITEABLE)) { in mtd_open()
118 put_mtd_device(mtd); in mtd_open()
125 put_mtd_device(mtd); in mtd_open()
129 mfi->mtd = mtd; in mtd_open()
142 struct mtd_info *mtd = mfi->mtd; in mtd_close() local
147 if ((file->f_mode & FMODE_WRITE) && mtd->sync) in mtd_close()
148 mtd->sync(mtd); in mtd_close()
150 put_mtd_device(mtd); in mtd_close()
165 struct mtd_info *mtd = mfi->mtd; in mtd_read() local
174 if (*ppos + count > mtd->size) in mtd_read()
175 count = mtd->size - *ppos; in mtd_read()
200 ret = mtd->read_fact_prot_reg(mtd, *ppos, len, &retlen, kbuf); in mtd_read()
203 ret = mtd->read_user_prot_reg(mtd, *ppos, len, &retlen, kbuf); in mtd_read()
214 ret = mtd->read_oob(mtd, *ppos, &ops); in mtd_read()
219 ret = mtd->read(mtd, *ppos, len, &retlen, kbuf); in mtd_read()
258 struct mtd_info *mtd = mfi->mtd; in mtd_write() local
267 if (*ppos == mtd->size) in mtd_write()
270 if (*ppos + count > mtd->size) in mtd_write()
271 count = mtd->size - *ppos; in mtd_write()
301 if (!mtd->write_user_prot_reg) { in mtd_write()
305 ret = mtd->write_user_prot_reg(mtd, *ppos, len, &retlen, kbuf); in mtd_write()
317 ret = mtd->write_oob(mtd, *ppos, &ops); in mtd_write()
323 ret = (*(mtd->write))(mtd, *ppos, len, &retlen, kbuf); in mtd_write()
354 struct mtd_info *mtd = mfi->mtd; in otp_select_filemode() local
359 if (!mtd->read_fact_prot_reg) in otp_select_filemode()
365 if (!mtd->read_fact_prot_reg) in otp_select_filemode()
385 struct mtd_info *mtd = mfi->mtd; in mtd_ioctl() local
405 if (copy_to_user(argp, &(mtd->numeraseregions), sizeof(int))) in mtd_ioctl()
418 kr = &(mtd->eraseregions[ur_idx]); in mtd_ioctl()
429 info.type = mtd->type; in mtd_ioctl()
430 info.flags = mtd->flags; in mtd_ioctl()
431 info.size = mtd->size; in mtd_ioctl()
432 info.erasesize = mtd->erasesize; in mtd_ioctl()
433 info.writesize = mtd->writesize; in mtd_ioctl()
434 info.oobsize = mtd->oobsize; in mtd_ioctl()
467 erase->mtd = mtd; in mtd_ioctl()
480 ret = mtd->erase(mtd, erase); in mtd_ioctl()
513 if (!mtd->write_oob) in mtd_ioctl()
523 ops.ooboffs = buf.start & (mtd->oobsize - 1); in mtd_ioctl()
527 if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) in mtd_ioctl()
539 buf.start &= ~(mtd->oobsize - 1); in mtd_ioctl()
540 ret = mtd->write_oob(mtd, buf.start, &ops); in mtd_ioctl()
564 if (!mtd->read_oob) in mtd_ioctl()
573 ops.ooboffs = buf.start & (mtd->oobsize - 1); in mtd_ioctl()
577 if (ops.ooboffs && ops.ooblen > (mtd->oobsize - ops.ooboffs)) in mtd_ioctl()
584 buf.start &= ~(mtd->oobsize - 1); in mtd_ioctl()
585 ret = mtd->read_oob(mtd, buf.start, &ops); in mtd_ioctl()
604 if (!mtd->lock) in mtd_ioctl()
607 ret = mtd->lock(mtd, einfo.start, einfo.length); in mtd_ioctl()
618 if (!mtd->unlock) in mtd_ioctl()
621 ret = mtd->unlock(mtd, einfo.start, einfo.length); in mtd_ioctl()
630 if (!mtd->ecclayout) in mtd_ioctl()
632 if (mtd->ecclayout->eccbytes > ARRAY_SIZE(oi.eccpos)) in mtd_ioctl()
636 memcpy(&oi.eccpos, mtd->ecclayout->eccpos, sizeof(oi.eccpos)); in mtd_ioctl()
637 memcpy(&oi.oobfree, mtd->ecclayout->oobfree, in mtd_ioctl()
639 oi.eccbytes = mtd->ecclayout->eccbytes; in mtd_ioctl()
652 if (!mtd->block_isbad) in mtd_ioctl()
655 return mtd->block_isbad(mtd, offs); in mtd_ioctl()
665 if (!mtd->block_markbad) in mtd_ioctl()
668 return mtd->block_markbad(mtd, offs); in mtd_ioctl()
696 if (mtd->get_fact_prot_info) in mtd_ioctl()
697 ret = mtd->get_fact_prot_info(mtd, buf, 4096); in mtd_ioctl()
700 if (mtd->get_user_prot_info) in mtd_ioctl()
701 ret = mtd->get_user_prot_info(mtd, buf, 4096); in mtd_ioctl()
727 if (!mtd->lock_user_prot_reg) in mtd_ioctl()
729 ret = mtd->lock_user_prot_reg(mtd, oinfo.start, oinfo.length); in mtd_ioctl()
736 if (!mtd->ecclayout) in mtd_ioctl()
739 if (copy_to_user(argp, mtd->ecclayout, in mtd_ioctl()
747 if (copy_to_user(argp, &mtd->ecc_stats, in mtd_ioctl()
764 if (!mtd->read_oob || !mtd->write_oob) in mtd_ioctl()