• Home
  • Raw
  • Download

Lines Matching refs:mtd

45 int add_mtd_device(struct mtd_info *mtd)  in add_mtd_device()  argument
49 BUG_ON(mtd->writesize == 0); in add_mtd_device()
56 mtd_table[i] = mtd; in add_mtd_device()
57 mtd->index = i; in add_mtd_device()
58 mtd->usecount = 0; in add_mtd_device()
60 if (is_power_of_2(mtd->erasesize)) in add_mtd_device()
61 mtd->erasesize_shift = ffs(mtd->erasesize) - 1; in add_mtd_device()
63 mtd->erasesize_shift = 0; in add_mtd_device()
65 if (is_power_of_2(mtd->writesize)) in add_mtd_device()
66 mtd->writesize_shift = ffs(mtd->writesize) - 1; in add_mtd_device()
68 mtd->writesize_shift = 0; in add_mtd_device()
70 mtd->erasesize_mask = (1 << mtd->erasesize_shift) - 1; in add_mtd_device()
71 mtd->writesize_mask = (1 << mtd->writesize_shift) - 1; in add_mtd_device()
74 if ((mtd->flags & MTD_WRITEABLE) in add_mtd_device()
75 && (mtd->flags & MTD_POWERUP_LOCK) && mtd->unlock) { in add_mtd_device()
76 if (mtd->unlock(mtd, 0, mtd->size)) in add_mtd_device()
80 mtd->name); in add_mtd_device()
83 DEBUG(0, "mtd: Giving out device %d to %s\n",i, mtd->name); in add_mtd_device()
87 not->add(mtd); in add_mtd_device()
112 int del_mtd_device (struct mtd_info *mtd) in del_mtd_device() argument
118 if (mtd_table[mtd->index] != mtd) { in del_mtd_device()
120 } else if (mtd->usecount) { in del_mtd_device()
122 mtd->index, mtd->name, mtd->usecount); in del_mtd_device()
130 not->remove(mtd); in del_mtd_device()
132 mtd_table[mtd->index] = NULL; in del_mtd_device()
208 struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num) in get_mtd_device() argument
217 if (mtd_table[i] == mtd) in get_mtd_device()
221 if (mtd && mtd != ret) in get_mtd_device()
260 struct mtd_info *mtd = NULL; in get_mtd_device_nm() local
266 mtd = mtd_table[i]; in get_mtd_device_nm()
271 if (!mtd) in get_mtd_device_nm()
274 if (!try_module_get(mtd->owner)) in get_mtd_device_nm()
277 if (mtd->get_device) { in get_mtd_device_nm()
278 err = mtd->get_device(mtd); in get_mtd_device_nm()
283 mtd->usecount++; in get_mtd_device_nm()
285 return mtd; in get_mtd_device_nm()
288 module_put(mtd->owner); in get_mtd_device_nm()
294 void put_mtd_device(struct mtd_info *mtd) in put_mtd_device() argument
299 c = --mtd->usecount; in put_mtd_device()
300 if (mtd->put_device) in put_mtd_device()
301 mtd->put_device(mtd); in put_mtd_device()
305 module_put(mtd->owner); in put_mtd_device()
312 int default_mtd_writev(struct mtd_info *mtd, const struct kvec *vecs, in default_mtd_writev() argument
319 if(!mtd->write) { in default_mtd_writev()
325 ret = mtd->write(mtd, to, vecs[i].iov_len, &thislen, vecs[i].iov_base); in default_mtd_writev()