Lines Matching refs:master

424 	struct mtd_info *master = mtd_get_master(mtd);  in mtd_wunit_to_pairing_info()  local
425 int npairs = mtd_wunit_per_eb(master) / mtd_pairing_groups(master); in mtd_wunit_to_pairing_info()
430 if (master->pairing && master->pairing->get_info) in mtd_wunit_to_pairing_info()
431 return master->pairing->get_info(master, wunit, info); in mtd_wunit_to_pairing_info()
467 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_info_to_wunit() local
468 int ngroups = mtd_pairing_groups(master); in mtd_pairing_info_to_wunit()
469 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_pairing_info_to_wunit()
475 if (master->pairing && master->pairing->get_wunit) in mtd_pairing_info_to_wunit()
476 return mtd->pairing->get_wunit(master, info); in mtd_pairing_info_to_wunit()
494 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_groups() local
496 if (!master->pairing || !master->pairing->ngroups) in mtd_pairing_groups()
499 return master->pairing->ngroups; in mtd_pairing_groups()
616 struct mtd_info *master = mtd_get_master(mtd); in add_mtd_device() local
638 if (WARN_ON((!mtd->erasesize || !master->_erase) && in add_mtd_device()
651 (!mtd_is_partition(mtd) || master->type != MTD_MLCNANDFLASH || in add_mtd_device()
652 !master->pairing || master->_writev)) in add_mtd_device()
677 int ngroups = mtd_pairing_groups(master); in add_mtd_device()
680 mtd->size = (u64)mtd_div_by_eb(mtd->size, master) * in add_mtd_device()
841 mutex_init(&mtd->master.partitions_lock); in mtd_set_dev_defaults()
842 mutex_init(&mtd->master.chrdev_lock); in mtd_set_dev_defaults()
1080 int mtd_device_unregister(struct mtd_info *master) in mtd_device_unregister() argument
1084 if (master->_reboot) { in mtd_device_unregister()
1085 unregister_reboot_notifier(&master->reboot_notifier); in mtd_device_unregister()
1086 memset(&master->reboot_notifier, 0, sizeof(master->reboot_notifier)); in mtd_device_unregister()
1089 nvmem_unregister(master->otp_user_nvmem); in mtd_device_unregister()
1090 nvmem_unregister(master->otp_factory_nvmem); in mtd_device_unregister()
1092 err = del_mtd_partitions(master); in mtd_device_unregister()
1096 if (!device_is_registered(&master->dev)) in mtd_device_unregister()
1099 return del_mtd_device(master); in mtd_device_unregister()
1202 struct mtd_info *master = mtd_get_master(mtd); in __get_mtd_device() local
1205 if (!try_module_get(master->owner)) in __get_mtd_device()
1208 if (master->_get_device) { in __get_mtd_device()
1209 err = master->_get_device(mtd); in __get_mtd_device()
1212 module_put(master->owner); in __get_mtd_device()
1217 master->usecount++; in __get_mtd_device()
1305 struct mtd_info *master = mtd_get_master(mtd); in __put_mtd_device() local
1313 master->usecount--; in __put_mtd_device()
1315 if (master->_put_device) in __put_mtd_device()
1316 master->_put_device(master); in __put_mtd_device()
1318 module_put(master->owner); in __put_mtd_device()
1329 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase() local
1337 if (!mtd->erasesize || !master->_erase) in mtd_erase()
1352 master->erasesize; in mtd_erase()
1354 master->erasesize) - in mtd_erase()
1360 ret = master->_erase(master, &adjinstr); in mtd_erase()
1366 master); in mtd_erase()
1381 struct mtd_info *master = mtd_get_master(mtd); in mtd_point() local
1387 if (!master->_point) in mtd_point()
1395 return master->_point(master, from, len, retlen, virt, phys); in mtd_point()
1402 struct mtd_info *master = mtd_get_master(mtd); in mtd_unpoint() local
1404 if (!master->_unpoint) in mtd_unpoint()
1410 return master->_unpoint(master, mtd_get_master_ofs(mtd, from), len); in mtd_unpoint()
1437 static void mtd_update_ecc_stats(struct mtd_info *mtd, struct mtd_info *master, in mtd_update_ecc_stats() argument
1442 if (master == mtd) in mtd_update_ecc_stats()
1445 diff = master->ecc_stats; in mtd_update_ecc_stats()
1498 struct mtd_info *master = mtd_get_master(mtd); in mtd_panic_write() local
1501 if (!master->_panic_write) in mtd_panic_write()
1509 if (!master->oops_panic_write) in mtd_panic_write()
1510 master->oops_panic_write = true; in mtd_panic_write()
1512 return master->_panic_write(master, mtd_get_master_ofs(mtd, to), len, in mtd_panic_write()
1553 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob_std() local
1557 if (master->_read_oob) in mtd_read_oob_std()
1558 ret = master->_read_oob(master, from, ops); in mtd_read_oob_std()
1560 ret = master->_read(master, from, ops->len, &ops->retlen, in mtd_read_oob_std()
1569 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob_std() local
1573 if (master->_write_oob) in mtd_write_oob_std()
1574 ret = master->_write_oob(master, to, ops); in mtd_write_oob_std()
1576 ret = master->_write(master, to, ops->len, &ops->retlen, in mtd_write_oob_std()
1585 struct mtd_info *master = mtd_get_master(mtd); in mtd_io_emulated_slc() local
1586 int ngroups = mtd_pairing_groups(master); in mtd_io_emulated_slc()
1587 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_io_emulated_slc()
1596 base = (loff_t)mtd_div_by_eb(start, mtd) * master->erasesize; in mtd_io_emulated_slc()
1607 base += master->erasesize; in mtd_io_emulated_slc()
1610 wunit = mtd_pairing_info_to_wunit(master, &info); in mtd_io_emulated_slc()
1647 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob() local
1648 struct mtd_ecc_stats old_stats = master->ecc_stats; in mtd_read_oob()
1660 if (!master->_read_oob && (!master->_read || ops->oobbuf)) in mtd_read_oob()
1671 mtd_update_ecc_stats(mtd, master, &old_stats); in mtd_read_oob()
1692 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob() local
1707 if (!master->_write_oob && (!master->_write || ops->oobbuf)) in mtd_write_oob()
1736 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_ecc() local
1740 if (!master || section < 0) in mtd_ooblayout_ecc()
1743 if (!master->ooblayout || !master->ooblayout->ecc) in mtd_ooblayout_ecc()
1746 return master->ooblayout->ecc(master, section, oobecc); in mtd_ooblayout_ecc()
1770 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_free() local
1774 if (!master || section < 0) in mtd_ooblayout_free()
1777 if (!master->ooblayout || !master->ooblayout->free) in mtd_ooblayout_free()
1780 return master->ooblayout->free(master, section, oobfree); in mtd_ooblayout_free()
2089 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_fact_prot_info() local
2091 if (!master->_get_fact_prot_info) in mtd_get_fact_prot_info()
2095 return master->_get_fact_prot_info(master, len, retlen, buf); in mtd_get_fact_prot_info()
2102 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_fact_prot_reg() local
2105 if (!master->_read_fact_prot_reg) in mtd_read_fact_prot_reg()
2109 return master->_read_fact_prot_reg(master, from, len, retlen, buf); in mtd_read_fact_prot_reg()
2116 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_user_prot_info() local
2118 if (!master->_get_user_prot_info) in mtd_get_user_prot_info()
2122 return master->_get_user_prot_info(master, len, retlen, buf); in mtd_get_user_prot_info()
2129 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_user_prot_reg() local
2132 if (!master->_read_user_prot_reg) in mtd_read_user_prot_reg()
2136 return master->_read_user_prot_reg(master, from, len, retlen, buf); in mtd_read_user_prot_reg()
2143 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_user_prot_reg() local
2147 if (!master->_write_user_prot_reg) in mtd_write_user_prot_reg()
2151 ret = master->_write_user_prot_reg(master, to, len, retlen, buf); in mtd_write_user_prot_reg()
2165 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock_user_prot_reg() local
2167 if (!master->_lock_user_prot_reg) in mtd_lock_user_prot_reg()
2171 return master->_lock_user_prot_reg(master, from, len); in mtd_lock_user_prot_reg()
2177 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase_user_prot_reg() local
2179 if (!master->_erase_user_prot_reg) in mtd_erase_user_prot_reg()
2183 return master->_erase_user_prot_reg(master, from, len); in mtd_erase_user_prot_reg()
2190 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock() local
2192 if (!master->_lock) in mtd_lock()
2200 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_lock()
2201 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_lock()
2204 return master->_lock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_lock()
2210 struct mtd_info *master = mtd_get_master(mtd); in mtd_unlock() local
2212 if (!master->_unlock) in mtd_unlock()
2220 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_unlock()
2221 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_unlock()
2224 return master->_unlock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_unlock()
2230 struct mtd_info *master = mtd_get_master(mtd); in mtd_is_locked() local
2232 if (!master->_is_locked) in mtd_is_locked()
2240 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_is_locked()
2241 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_is_locked()
2244 return master->_is_locked(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_is_locked()
2250 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isreserved() local
2254 if (!master->_block_isreserved) in mtd_block_isreserved()
2258 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isreserved()
2260 return master->_block_isreserved(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isreserved()
2266 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isbad() local
2270 if (!master->_block_isbad) in mtd_block_isbad()
2274 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isbad()
2276 return master->_block_isbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isbad()
2282 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_markbad() local
2285 if (!master->_block_markbad) in mtd_block_markbad()
2293 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_markbad()
2295 ret = master->_block_markbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_markbad()
2354 struct mtd_info *master = mtd_get_master(mtd); in mtd_writev() local
2360 if (!master->_writev) in mtd_writev()
2363 return master->_writev(master, vecs, count, in mtd_writev()