Lines Matching +full:attr +full:- +full:cnt +full:- +full:name

1 // SPDX-License-Identifier: GPL-2.0+
6 * Copyright © 1999-2010 David Woodhouse <dwmw2@infradead.org>
25 #include <linux/backing-dev.h>
41 * backing device capabilities for non-mappable devices (such as NAND flash)
42 * - permits private mappings, copies are taken of the data
50 * - permits private mappings, copies are taken of the data
51 * - permits non-writable shared mappings
60 * - permits private mappings, copies are taken of the data
61 * - permits non-writable shared mappings
73 .name = "mtd",
93 #define DEFINE_IDR(name) struct idr name; argument
97 if (idp->id[id].used) { in idr_remove()
98 idp->id[id].used = 0; in idr_remove()
99 idp->updated = true; in idr_remove()
106 if (idp->id[id].used) in idr_find()
107 return idp->id[id].ptr; in idr_find()
120 if (!idp->id[id].used) in idr_get_next()
136 idl = &idp->id[i]; in idr_alloc()
137 if (idl->used == 0) { in idr_alloc()
138 idl->used = 1; in idr_alloc()
139 idl->ptr = ptr; in idr_alloc()
140 idp->updated = true; in idr_alloc()
145 return -ENOSPC; in idr_alloc()
184 dev_t index = MTD_DEVT(mtd->index); in mtd_release()
208 struct device_attribute *attr, char *buf) in mtd_type_show() argument
213 switch (mtd->type) { in mtd_type_show()
236 type = "mlc-nand"; in mtd_type_show()
247 struct device_attribute *attr, char *buf) in mtd_flags_show() argument
251 return snprintf(buf, PAGE_SIZE, "0x%lx\n", (unsigned long)mtd->flags); in mtd_flags_show()
257 struct device_attribute *attr, char *buf) in mtd_size_show() argument
262 (unsigned long long)mtd->size); in mtd_size_show()
268 struct device_attribute *attr, char *buf) in mtd_erasesize_show() argument
272 return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->erasesize); in mtd_erasesize_show()
278 struct device_attribute *attr, char *buf) in mtd_writesize_show() argument
282 return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->writesize); in mtd_writesize_show()
288 struct device_attribute *attr, char *buf) in mtd_subpagesize_show() argument
291 unsigned int subpagesize = mtd->writesize >> mtd->subpage_sft; in mtd_subpagesize_show()
299 struct device_attribute *attr, char *buf) in mtd_oobsize_show() argument
303 return snprintf(buf, PAGE_SIZE, "%lu\n", (unsigned long)mtd->oobsize); in mtd_oobsize_show()
309 struct device_attribute *attr, char *buf) in mtd_numeraseregions_show() argument
313 return snprintf(buf, PAGE_SIZE, "%u\n", mtd->numeraseregions); in mtd_numeraseregions_show()
320 struct device_attribute *attr, char *buf) in mtd_name_show() argument
324 return snprintf(buf, PAGE_SIZE, "%s\n", mtd->name); in mtd_name_show()
327 static DEVICE_ATTR(name, S_IRUGO, mtd_name_show, NULL);
330 struct device_attribute *attr, char *buf) in mtd_ecc_strength_show() argument
334 return snprintf(buf, PAGE_SIZE, "%u\n", mtd->ecc_strength); in mtd_ecc_strength_show()
339 struct device_attribute *attr, in mtd_bitflip_threshold_show() argument
344 return snprintf(buf, PAGE_SIZE, "%u\n", mtd->bitflip_threshold); in mtd_bitflip_threshold_show()
348 struct device_attribute *attr, in mtd_bitflip_threshold_store() argument
359 mtd->bitflip_threshold = bitflip_threshold; in mtd_bitflip_threshold_store()
367 struct device_attribute *attr, char *buf) in mtd_ecc_step_size_show() argument
371 return snprintf(buf, PAGE_SIZE, "%u\n", mtd->ecc_step_size); in mtd_ecc_step_size_show()
377 &dev_attr_type.attr,
378 &dev_attr_flags.attr,
379 &dev_attr_size.attr,
380 &dev_attr_erasesize.attr,
381 &dev_attr_writesize.attr,
382 &dev_attr_subpagesize.attr,
383 &dev_attr_oobsize.attr,
384 &dev_attr_numeraseregions.attr,
385 &dev_attr_name.attr,
386 &dev_attr_ecc_strength.attr,
387 &dev_attr_ecc_step_size.attr,
388 &dev_attr_bitflip_threshold.attr,
394 .name = "mtd",
401 * add_mtd_device - register an MTD device
418 if (!mtd->backing_dev_info) { in add_mtd_device()
419 switch (mtd->type) { in add_mtd_device()
421 mtd->backing_dev_info = &mtd_bdi_rw_mappable; in add_mtd_device()
424 mtd->backing_dev_info = &mtd_bdi_ro_mappable; in add_mtd_device()
427 mtd->backing_dev_info = &mtd_bdi_unmappable; in add_mtd_device()
433 BUG_ON(mtd->writesize == 0); in add_mtd_device()
440 mtd->index = i; in add_mtd_device()
441 mtd->usecount = 0; in add_mtd_device()
443 INIT_LIST_HEAD(&mtd->partitions); in add_mtd_device()
446 if (mtd->bitflip_threshold == 0) in add_mtd_device()
447 mtd->bitflip_threshold = mtd->ecc_strength; in add_mtd_device()
449 if (is_power_of_2(mtd->erasesize)) in add_mtd_device()
450 mtd->erasesize_shift = ffs(mtd->erasesize) - 1; in add_mtd_device()
452 mtd->erasesize_shift = 0; in add_mtd_device()
454 if (is_power_of_2(mtd->writesize)) in add_mtd_device()
455 mtd->writesize_shift = ffs(mtd->writesize) - 1; in add_mtd_device()
457 mtd->writesize_shift = 0; in add_mtd_device()
459 mtd->erasesize_mask = (1 << mtd->erasesize_shift) - 1; in add_mtd_device()
460 mtd->writesize_mask = (1 << mtd->writesize_shift) - 1; in add_mtd_device()
463 if ((mtd->flags & MTD_WRITEABLE) && (mtd->flags & MTD_POWERUP_LOCK)) { in add_mtd_device()
464 error = mtd_unlock(mtd, 0, mtd->size); in add_mtd_device()
465 if (error && error != -EOPNOTSUPP) in add_mtd_device()
468 mtd->name); in add_mtd_device()
475 mtd->dev.type = &mtd_devtype; in add_mtd_device()
476 mtd->dev.class = &mtd_class; in add_mtd_device()
477 mtd->dev.devt = MTD_DEVT(i); in add_mtd_device()
478 dev_set_name(&mtd->dev, "mtd%d", i); in add_mtd_device()
479 dev_set_drvdata(&mtd->dev, mtd); in add_mtd_device()
480 if (device_register(&mtd->dev) != 0) in add_mtd_device()
484 device_create(&mtd_class, mtd->dev.parent, in add_mtd_device()
488 pr_debug("mtd: Giving out device %d to %s\n", i, mtd->name); in add_mtd_device()
492 not->add(mtd); in add_mtd_device()
494 pr_debug("mtd: Giving out device %d to %s\n", i, mtd->name); in add_mtd_device()
515 * del_mtd_device - unregister an MTD device
534 mtd->name, ret); in del_mtd_device()
540 if (idr_find(&mtd_idr, mtd->index) != mtd) { in del_mtd_device()
541 ret = -ENODEV; in del_mtd_device()
549 not->remove(mtd); in del_mtd_device()
552 if (mtd->usecount) { in del_mtd_device()
554 mtd->index, mtd->name, mtd->usecount); in del_mtd_device()
555 ret = -EBUSY; in del_mtd_device()
558 device_unregister(&mtd->dev); in del_mtd_device()
561 idr_remove(&mtd_idr, mtd->index); in del_mtd_device()
574 * mtd_device_parse_register - parse partitions and register an MTD device.
579 * @parser_data: MTD partition parser-specific data
614 err = -ENOMEM; in mtd_device_parse_register()
625 err = -ENODEV; in mtd_device_parse_register()
633 * mtd_device_unregister - unregister an existing MTD device.
646 if (!device_is_registered(&master->dev)) in mtd_device_unregister()
654 * register_mtd_user - register a 'user' of MTD devices.
667 list_add(&new->list, &mtd_notifiers); in register_mtd_user()
672 new->add(mtd); in register_mtd_user()
679 * unregister_mtd_user - unregister a 'user' of MTD devices.
696 old->remove(mtd); in unregister_mtd_user()
698 list_del(&old->list); in unregister_mtd_user()
706 * get_mtd_device - obtain a validated handle for an MTD device
711 * table, if any. Given an address and num == -1, search the device table
719 int err = -ENODEV; in get_mtd_device()
723 if (num == -1) { in get_mtd_device()
755 if (!try_module_get(mtd->owner)) in __get_mtd_device()
756 return -ENODEV; in __get_mtd_device()
758 if (mtd->_get_device) { in __get_mtd_device()
759 err = mtd->_get_device(mtd); in __get_mtd_device()
762 module_put(mtd->owner); in __get_mtd_device()
766 mtd->usecount++; in __get_mtd_device()
772 * get_mtd_device_nm - obtain a validated handle for an MTD device by
773 * device name
774 * @name: MTD device name to open
779 struct mtd_info *get_mtd_device_nm(const char *name) in get_mtd_device_nm() argument
781 int err = -ENODEV; in get_mtd_device_nm()
787 if (!strcmp(name, other->name)) { in get_mtd_device_nm()
828 if (!mtd->_block_isbad) { in mtd_get_len_incl_bad()
837 if (offset >= mtd->size) { in mtd_get_len_incl_bad()
842 block_len = mtd->erasesize - (offset & (mtd->erasesize - 1)); in mtd_get_len_incl_bad()
844 if (!mtd->_block_isbad(mtd, offset & ~(mtd->erasesize - 1))) in mtd_get_len_incl_bad()
864 --mtd->usecount; in __put_mtd_device()
865 BUG_ON(mtd->usecount < 0); in __put_mtd_device()
867 if (mtd->_put_device) in __put_mtd_device()
868 mtd->_put_device(mtd); in __put_mtd_device()
870 module_put(mtd->owner); in __put_mtd_device()
876 * to call instr->callback() whenever the operation completes, even
883 if (instr->addr > mtd->size || instr->len > mtd->size - instr->addr) in mtd_erase()
884 return -EINVAL; in mtd_erase()
885 if (!(mtd->flags & MTD_WRITEABLE)) in mtd_erase()
886 return -EROFS; in mtd_erase()
887 instr->fail_addr = MTD_FAIL_ADDR_UNKNOWN; in mtd_erase()
888 if (!instr->len) { in mtd_erase()
889 instr->state = MTD_ERASE_DONE; in mtd_erase()
893 return mtd->_erase(mtd, instr); in mtd_erase()
899 * This stuff for eXecute-In-Place. phys is optional and may be set to NULL.
908 if (!mtd->_point) in mtd_point()
909 return -EOPNOTSUPP; in mtd_point()
910 if (from < 0 || from > mtd->size || len > mtd->size - from) in mtd_point()
911 return -EINVAL; in mtd_point()
914 return mtd->_point(mtd, from, len, retlen, virt, phys); in mtd_point()
921 if (!mtd->_point) in mtd_unpoint()
922 return -EOPNOTSUPP; in mtd_unpoint()
923 if (from < 0 || from > mtd->size || len > mtd->size - from) in mtd_unpoint()
924 return -EINVAL; in mtd_unpoint()
927 return mtd->_unpoint(mtd, from, len); in mtd_unpoint()
934 * - return the address to which the offset maps
935 * - return -ENOSYS to indicate refusal to do the mapping
940 if (!mtd->_get_unmapped_area) in mtd_get_unmapped_area()
941 return -EOPNOTSUPP; in mtd_get_unmapped_area()
942 if (offset > mtd->size || len > mtd->size - offset) in mtd_get_unmapped_area()
943 return -EINVAL; in mtd_get_unmapped_area()
944 return mtd->_get_unmapped_area(mtd, len, offset, flags); in mtd_get_unmapped_area()
953 if (from < 0 || from > mtd->size || len > mtd->size - from) in mtd_read()
954 return -EINVAL; in mtd_read()
959 * In the absence of an error, drivers return a non-negative integer in mtd_read()
963 if (mtd->_read) { in mtd_read()
964 ret_code = mtd->_read(mtd, from, len, retlen, buf); in mtd_read()
965 } else if (mtd->_read_oob) { in mtd_read()
971 ret_code = mtd->_read_oob(mtd, from, &ops); in mtd_read()
974 return -ENOTSUPP; in mtd_read()
979 if (mtd->ecc_strength == 0) in mtd_read()
981 return ret_code >= mtd->bitflip_threshold ? -EUCLEAN : 0; in mtd_read()
989 if (to < 0 || to > mtd->size || len > mtd->size - to) in mtd_write()
990 return -EINVAL; in mtd_write()
991 if ((!mtd->_write && !mtd->_write_oob) || in mtd_write()
992 !(mtd->flags & MTD_WRITEABLE)) in mtd_write()
993 return -EROFS; in mtd_write()
997 if (!mtd->_write) { in mtd_write()
1004 ret = mtd->_write_oob(mtd, to, &ops); in mtd_write()
1009 return mtd->_write(mtd, to, len, retlen, buf); in mtd_write()
1024 if (!mtd->_panic_write) in mtd_panic_write()
1025 return -EOPNOTSUPP; in mtd_panic_write()
1026 if (to < 0 || to > mtd->size || len > mtd->size - to) in mtd_panic_write()
1027 return -EINVAL; in mtd_panic_write()
1028 if (!(mtd->flags & MTD_WRITEABLE)) in mtd_panic_write()
1029 return -EROFS; in mtd_panic_write()
1032 return mtd->_panic_write(mtd, to, len, retlen, buf); in mtd_panic_write()
1040 * Some users are setting ->datbuf or ->oobbuf to NULL, but are leaving in mtd_check_oob_ops()
1041 * ->len or ->ooblen uninitialized. Force ->len and ->ooblen to 0 in in mtd_check_oob_ops()
1044 if (!ops->datbuf) in mtd_check_oob_ops()
1045 ops->len = 0; in mtd_check_oob_ops()
1047 if (!ops->oobbuf) in mtd_check_oob_ops()
1048 ops->ooblen = 0; in mtd_check_oob_ops()
1050 if (offs < 0 || offs + ops->len > mtd->size) in mtd_check_oob_ops()
1051 return -EINVAL; in mtd_check_oob_ops()
1053 if (ops->ooblen) { in mtd_check_oob_ops()
1056 if (ops->ooboffs >= mtd_oobavail(mtd, ops)) in mtd_check_oob_ops()
1057 return -EINVAL; in mtd_check_oob_ops()
1059 maxooblen = ((mtd_div_by_ws(mtd->size, mtd) - in mtd_check_oob_ops()
1061 mtd_oobavail(mtd, ops)) - ops->ooboffs; in mtd_check_oob_ops()
1062 if (ops->ooblen > maxooblen) in mtd_check_oob_ops()
1063 return -EINVAL; in mtd_check_oob_ops()
1072 ops->retlen = ops->oobretlen = 0; in mtd_read_oob()
1078 /* Check the validity of a potential fallback on mtd->_read */ in mtd_read_oob()
1079 if (!mtd->_read_oob && (!mtd->_read || ops->oobbuf)) in mtd_read_oob()
1080 return -EOPNOTSUPP; in mtd_read_oob()
1082 if (mtd->_read_oob) in mtd_read_oob()
1083 ret_code = mtd->_read_oob(mtd, from, ops); in mtd_read_oob()
1085 ret_code = mtd->_read(mtd, from, ops->len, &ops->retlen, in mtd_read_oob()
1086 ops->datbuf); in mtd_read_oob()
1089 * In cases where ops->datbuf != NULL, mtd->_read_oob() has semantics in mtd_read_oob()
1090 * similar to mtd->_read(), returning a non-negative integer in mtd_read_oob()
1091 * representing max bitflips. In other cases, mtd->_read_oob() may in mtd_read_oob()
1092 * return -EUCLEAN. In all cases, perform similar logic to mtd_read(). in mtd_read_oob()
1096 if (mtd->ecc_strength == 0) in mtd_read_oob()
1098 return ret_code >= mtd->bitflip_threshold ? -EUCLEAN : 0; in mtd_read_oob()
1107 ops->retlen = ops->oobretlen = 0; in mtd_write_oob()
1109 if (!(mtd->flags & MTD_WRITEABLE)) in mtd_write_oob()
1110 return -EROFS; in mtd_write_oob()
1116 /* Check the validity of a potential fallback on mtd->_write */ in mtd_write_oob()
1117 if (!mtd->_write_oob && (!mtd->_write || ops->oobbuf)) in mtd_write_oob()
1118 return -EOPNOTSUPP; in mtd_write_oob()
1120 if (mtd->_write_oob) in mtd_write_oob()
1121 return mtd->_write_oob(mtd, to, ops); in mtd_write_oob()
1123 return mtd->_write(mtd, to, ops->len, &ops->retlen, in mtd_write_oob()
1124 ops->datbuf); in mtd_write_oob()
1129 * mtd_ooblayout_ecc - Get the OOB region definition of a specific ECC section
1140 * mtd_ooblayout_ecc(mtd, section++, oobecc) until it returns -ERANGE.
1150 return -EINVAL; in mtd_ooblayout_ecc()
1152 if (!mtd->ooblayout || !mtd->ooblayout->ecc) in mtd_ooblayout_ecc()
1153 return -ENOTSUPP; in mtd_ooblayout_ecc()
1155 return mtd->ooblayout->ecc(mtd, section, oobecc); in mtd_ooblayout_ecc()
1160 * mtd_ooblayout_free - Get the OOB region definition of a specific free
1172 * mtd_ooblayout_free(mtd, section++, oobfree) until it returns -ERANGE.
1182 return -EINVAL; in mtd_ooblayout_free()
1184 if (!mtd->ooblayout || !mtd->ooblayout->free) in mtd_ooblayout_free()
1185 return -ENOTSUPP; in mtd_ooblayout_free()
1187 return mtd->ooblayout->free(mtd, section, oobfree); in mtd_ooblayout_free()
1192 * mtd_ooblayout_find_region - Find the region attached to a specific byte
1223 if (pos + oobregion->length > byte) in mtd_ooblayout_find_region()
1226 pos += oobregion->length; in mtd_ooblayout_find_region()
1234 oobregion->offset += byte - pos; in mtd_ooblayout_find_region()
1235 oobregion->length -= byte - pos; in mtd_ooblayout_find_region()
1242 * mtd_ooblayout_find_eccregion - Find the ECC region attached to a specific
1264 * mtd_ooblayout_get_bytes - Extract OOB bytes from the oob buffer
1290 int cnt; in mtd_ooblayout_get_bytes() local
1292 cnt = min_t(int, nbytes, oobregion.length); in mtd_ooblayout_get_bytes()
1293 memcpy(buf, oobbuf + oobregion.offset, cnt); in mtd_ooblayout_get_bytes()
1294 buf += cnt; in mtd_ooblayout_get_bytes()
1295 nbytes -= cnt; in mtd_ooblayout_get_bytes()
1307 * mtd_ooblayout_set_bytes - put OOB bytes into the oob buffer
1333 int cnt; in mtd_ooblayout_set_bytes() local
1335 cnt = min_t(int, nbytes, oobregion.length); in mtd_ooblayout_set_bytes()
1336 memcpy(oobbuf + oobregion.offset, buf, cnt); in mtd_ooblayout_set_bytes()
1337 buf += cnt; in mtd_ooblayout_set_bytes()
1338 nbytes -= cnt; in mtd_ooblayout_set_bytes()
1350 * mtd_ooblayout_count_bytes - count the number of bytes in a OOB category
1369 if (ret == -ERANGE) in mtd_ooblayout_count_bytes()
1381 * mtd_ooblayout_get_eccbytes - extract ECC bytes from the oob buffer
1401 * mtd_ooblayout_set_eccbytes - set ECC bytes into the oob buffer
1421 * mtd_ooblayout_get_databytes - extract data bytes from the oob buffer
1441 * mtd_ooblayout_get_eccbytes - set data bytes into the oob buffer
1461 * mtd_ooblayout_count_freebytes - count the number of free bytes in OOB
1475 * mtd_ooblayout_count_freebytes - count the number of ECC bytes in OOB
1496 if (!mtd->_get_fact_prot_info) in mtd_get_fact_prot_info()
1497 return -EOPNOTSUPP; in mtd_get_fact_prot_info()
1500 return mtd->_get_fact_prot_info(mtd, len, retlen, buf); in mtd_get_fact_prot_info()
1508 if (!mtd->_read_fact_prot_reg) in mtd_read_fact_prot_reg()
1509 return -EOPNOTSUPP; in mtd_read_fact_prot_reg()
1512 return mtd->_read_fact_prot_reg(mtd, from, len, retlen, buf); in mtd_read_fact_prot_reg()
1519 if (!mtd->_get_user_prot_info) in mtd_get_user_prot_info()
1520 return -EOPNOTSUPP; in mtd_get_user_prot_info()
1523 return mtd->_get_user_prot_info(mtd, len, retlen, buf); in mtd_get_user_prot_info()
1531 if (!mtd->_read_user_prot_reg) in mtd_read_user_prot_reg()
1532 return -EOPNOTSUPP; in mtd_read_user_prot_reg()
1535 return mtd->_read_user_prot_reg(mtd, from, len, retlen, buf); in mtd_read_user_prot_reg()
1545 if (!mtd->_write_user_prot_reg) in mtd_write_user_prot_reg()
1546 return -EOPNOTSUPP; in mtd_write_user_prot_reg()
1549 ret = mtd->_write_user_prot_reg(mtd, to, len, retlen, buf); in mtd_write_user_prot_reg()
1555 * must return -ENOSPC. in mtd_write_user_prot_reg()
1557 return (*retlen) ? 0 : -ENOSPC; in mtd_write_user_prot_reg()
1563 if (!mtd->_lock_user_prot_reg) in mtd_lock_user_prot_reg()
1564 return -EOPNOTSUPP; in mtd_lock_user_prot_reg()
1567 return mtd->_lock_user_prot_reg(mtd, from, len); in mtd_lock_user_prot_reg()
1571 /* Chip-supported device locking */
1574 if (!mtd->_lock) in mtd_lock()
1575 return -EOPNOTSUPP; in mtd_lock()
1576 if (ofs < 0 || ofs > mtd->size || len > mtd->size - ofs) in mtd_lock()
1577 return -EINVAL; in mtd_lock()
1580 return mtd->_lock(mtd, ofs, len); in mtd_lock()
1586 if (!mtd->_unlock) in mtd_unlock()
1587 return -EOPNOTSUPP; in mtd_unlock()
1588 if (ofs < 0 || ofs > mtd->size || len > mtd->size - ofs) in mtd_unlock()
1589 return -EINVAL; in mtd_unlock()
1592 return mtd->_unlock(mtd, ofs, len); in mtd_unlock()
1598 if (!mtd->_is_locked) in mtd_is_locked()
1599 return -EOPNOTSUPP; in mtd_is_locked()
1600 if (ofs < 0 || ofs > mtd->size || len > mtd->size - ofs) in mtd_is_locked()
1601 return -EINVAL; in mtd_is_locked()
1604 return mtd->_is_locked(mtd, ofs, len); in mtd_is_locked()
1610 if (ofs < 0 || ofs > mtd->size) in mtd_block_isreserved()
1611 return -EINVAL; in mtd_block_isreserved()
1612 if (!mtd->_block_isreserved) in mtd_block_isreserved()
1614 return mtd->_block_isreserved(mtd, ofs); in mtd_block_isreserved()
1620 if (ofs < 0 || ofs > mtd->size) in mtd_block_isbad()
1621 return -EINVAL; in mtd_block_isbad()
1622 if (!mtd->_block_isbad) in mtd_block_isbad()
1624 return mtd->_block_isbad(mtd, ofs); in mtd_block_isbad()
1630 if (!mtd->_block_markbad) in mtd_block_markbad()
1631 return -EOPNOTSUPP; in mtd_block_markbad()
1632 if (ofs < 0 || ofs > mtd->size) in mtd_block_markbad()
1633 return -EINVAL; in mtd_block_markbad()
1634 if (!(mtd->flags & MTD_WRITEABLE)) in mtd_block_markbad()
1635 return -EROFS; in mtd_block_markbad()
1636 return mtd->_block_markbad(mtd, ofs); in mtd_block_markbad()
1642 * default_mtd_writev - the default writev method
1674 * mtd_writev - the vector-based MTD write method
1688 if (!(mtd->flags & MTD_WRITEABLE)) in mtd_writev()
1689 return -EROFS; in mtd_writev()
1690 if (!mtd->_writev) in mtd_writev()
1692 return mtd->_writev(mtd, vecs, count, to, retlen); in mtd_writev()
1697 * mtd_kmalloc_up_to - allocate a contiguous buffer up to the specified size
1707 * ask the memory allocator to avoid re-trying, swapping, writing back
1711 * the MTD device's min. I/O unit, i.e. the "mtd->writesize" value.
1714 * to handle smaller (i.e. degraded) buffer allocations under low- or
1715 * fragmented-memory situations where such reduced allocations, from a
1724 size_t min_alloc = max_t(size_t, mtd->writesize, PAGE_SIZE); in mtd_kmalloc_up_to()
1735 *size = ALIGN(*size, mtd->writesize); in mtd_kmalloc_up_to()
1740 * things (write-back, dropping caches, etc) by using GFP_KERNEL. in mtd_kmalloc_up_to()
1756 seq_puts(m, "dev: size erasesize name\n"); in mtd_proc_show()
1760 mtd->index, (unsigned long long)mtd->size, in mtd_proc_show()
1761 mtd->erasesize, mtd->name); in mtd_proc_show()
1784 static int __init mtd_bdi_init(struct backing_dev_info *bdi, const char *name) in mtd_bdi_init() argument
1790 ret = bdi_register(bdi, NULL, "%s", name); in mtd_bdi_init()
1808 ret = mtd_bdi_init(&mtd_bdi_unmappable, "mtd-unmap"); in init_mtd()
1812 ret = mtd_bdi_init(&mtd_bdi_ro_mappable, "mtd-romap"); in init_mtd()
1816 ret = mtd_bdi_init(&mtd_bdi_rw_mappable, "mtd-rwmap"); in init_mtd()