Lines Matching refs:master

365 	struct mtd_info *master = mtd_get_master(mtd);  in mtd_debugfs_populate()  local
375 if (master->dbg.partid) in mtd_debugfs_populate()
376 debugfs_create_file("partid", 0400, root, master, in mtd_debugfs_populate()
379 if (master->dbg.partname) in mtd_debugfs_populate()
380 debugfs_create_file("partname", 0400, root, master, in mtd_debugfs_populate()
441 struct mtd_info *master = mtd_get_master(mtd); in mtd_wunit_to_pairing_info() local
442 int npairs = mtd_wunit_per_eb(master) / mtd_pairing_groups(master); in mtd_wunit_to_pairing_info()
447 if (master->pairing && master->pairing->get_info) in mtd_wunit_to_pairing_info()
448 return master->pairing->get_info(master, wunit, info); in mtd_wunit_to_pairing_info()
484 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_info_to_wunit() local
485 int ngroups = mtd_pairing_groups(master); in mtd_pairing_info_to_wunit()
486 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_pairing_info_to_wunit()
492 if (master->pairing && master->pairing->get_wunit) in mtd_pairing_info_to_wunit()
493 return mtd->pairing->get_wunit(master, info); in mtd_pairing_info_to_wunit()
511 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_groups() local
513 if (!master->pairing || !master->pairing->ngroups) in mtd_pairing_groups()
516 return master->pairing->ngroups; in mtd_pairing_groups()
577 struct mtd_info *master = mtd_get_master(mtd); in add_mtd_device() local
599 if (WARN_ON((!mtd->erasesize || !master->_erase) && in add_mtd_device()
612 (!mtd_is_partition(mtd) || master->type != MTD_MLCNANDFLASH || in add_mtd_device()
613 !master->pairing || master->_writev)) in add_mtd_device()
632 int ngroups = mtd_pairing_groups(master); in add_mtd_device()
635 mtd->size = (u64)mtd_div_by_eb(mtd->size, master) * in add_mtd_device()
778 mutex_init(&mtd->master.partitions_lock); in mtd_set_dev_defaults()
779 mutex_init(&mtd->master.chrdev_lock); in mtd_set_dev_defaults()
1017 int mtd_device_unregister(struct mtd_info *master) in mtd_device_unregister() argument
1021 if (master->_reboot) in mtd_device_unregister()
1022 unregister_reboot_notifier(&master->reboot_notifier); in mtd_device_unregister()
1024 if (master->otp_user_nvmem) in mtd_device_unregister()
1025 nvmem_unregister(master->otp_user_nvmem); in mtd_device_unregister()
1027 if (master->otp_factory_nvmem) in mtd_device_unregister()
1028 nvmem_unregister(master->otp_factory_nvmem); in mtd_device_unregister()
1030 err = del_mtd_partitions(master); in mtd_device_unregister()
1034 if (!device_is_registered(&master->dev)) in mtd_device_unregister()
1037 return del_mtd_device(master); in mtd_device_unregister()
1140 struct mtd_info *master = mtd_get_master(mtd); in __get_mtd_device() local
1143 if (!try_module_get(master->owner)) in __get_mtd_device()
1146 if (master->_get_device) { in __get_mtd_device()
1147 err = master->_get_device(mtd); in __get_mtd_device()
1150 module_put(master->owner); in __get_mtd_device()
1155 master->usecount++; in __get_mtd_device()
1215 struct mtd_info *master = mtd_get_master(mtd); in __put_mtd_device() local
1223 master->usecount--; in __put_mtd_device()
1225 if (master->_put_device) in __put_mtd_device()
1226 master->_put_device(master); in __put_mtd_device()
1228 module_put(master->owner); in __put_mtd_device()
1239 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase() local
1247 if (!mtd->erasesize || !master->_erase) in mtd_erase()
1262 master->erasesize; in mtd_erase()
1264 master->erasesize) - in mtd_erase()
1270 ret = master->_erase(master, &adjinstr); in mtd_erase()
1276 master); in mtd_erase()
1291 struct mtd_info *master = mtd_get_master(mtd); in mtd_point() local
1297 if (!master->_point) in mtd_point()
1305 return master->_point(master, from, len, retlen, virt, phys); in mtd_point()
1312 struct mtd_info *master = mtd_get_master(mtd); in mtd_unpoint() local
1314 if (!master->_unpoint) in mtd_unpoint()
1320 return master->_unpoint(master, mtd_get_master_ofs(mtd, from), len); in mtd_unpoint()
1347 static void mtd_update_ecc_stats(struct mtd_info *mtd, struct mtd_info *master, in mtd_update_ecc_stats() argument
1352 if (master == mtd) in mtd_update_ecc_stats()
1355 diff = master->ecc_stats; in mtd_update_ecc_stats()
1408 struct mtd_info *master = mtd_get_master(mtd); in mtd_panic_write() local
1411 if (!master->_panic_write) in mtd_panic_write()
1419 if (!master->oops_panic_write) in mtd_panic_write()
1420 master->oops_panic_write = true; in mtd_panic_write()
1422 return master->_panic_write(master, mtd_get_master_ofs(mtd, to), len, in mtd_panic_write()
1463 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob_std() local
1467 if (master->_read_oob) in mtd_read_oob_std()
1468 ret = master->_read_oob(master, from, ops); in mtd_read_oob_std()
1470 ret = master->_read(master, from, ops->len, &ops->retlen, in mtd_read_oob_std()
1479 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob_std() local
1483 if (master->_write_oob) in mtd_write_oob_std()
1484 ret = master->_write_oob(master, to, ops); in mtd_write_oob_std()
1486 ret = master->_write(master, to, ops->len, &ops->retlen, in mtd_write_oob_std()
1495 struct mtd_info *master = mtd_get_master(mtd); in mtd_io_emulated_slc() local
1496 int ngroups = mtd_pairing_groups(master); in mtd_io_emulated_slc()
1497 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_io_emulated_slc()
1506 base = (loff_t)mtd_div_by_eb(start, mtd) * master->erasesize; in mtd_io_emulated_slc()
1517 base += master->erasesize; in mtd_io_emulated_slc()
1520 wunit = mtd_pairing_info_to_wunit(master, &info); in mtd_io_emulated_slc()
1557 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob() local
1558 struct mtd_ecc_stats old_stats = master->ecc_stats; in mtd_read_oob()
1570 if (!master->_read_oob && (!master->_read || ops->oobbuf)) in mtd_read_oob()
1578 mtd_update_ecc_stats(mtd, master, &old_stats); in mtd_read_oob()
1597 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob() local
1612 if (!master->_write_oob && (!master->_write || ops->oobbuf)) in mtd_write_oob()
1641 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_ecc() local
1645 if (!master || section < 0) in mtd_ooblayout_ecc()
1648 if (!master->ooblayout || !master->ooblayout->ecc) in mtd_ooblayout_ecc()
1651 return master->ooblayout->ecc(master, section, oobecc); in mtd_ooblayout_ecc()
1675 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_free() local
1679 if (!master || section < 0) in mtd_ooblayout_free()
1682 if (!master->ooblayout || !master->ooblayout->free) in mtd_ooblayout_free()
1685 return master->ooblayout->free(master, section, oobfree); in mtd_ooblayout_free()
1994 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_fact_prot_info() local
1996 if (!master->_get_fact_prot_info) in mtd_get_fact_prot_info()
2000 return master->_get_fact_prot_info(master, len, retlen, buf); in mtd_get_fact_prot_info()
2007 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_fact_prot_reg() local
2010 if (!master->_read_fact_prot_reg) in mtd_read_fact_prot_reg()
2014 return master->_read_fact_prot_reg(master, from, len, retlen, buf); in mtd_read_fact_prot_reg()
2021 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_user_prot_info() local
2023 if (!master->_get_user_prot_info) in mtd_get_user_prot_info()
2027 return master->_get_user_prot_info(master, len, retlen, buf); in mtd_get_user_prot_info()
2034 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_user_prot_reg() local
2037 if (!master->_read_user_prot_reg) in mtd_read_user_prot_reg()
2041 return master->_read_user_prot_reg(master, from, len, retlen, buf); in mtd_read_user_prot_reg()
2048 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_user_prot_reg() local
2052 if (!master->_write_user_prot_reg) in mtd_write_user_prot_reg()
2056 ret = master->_write_user_prot_reg(master, to, len, retlen, buf); in mtd_write_user_prot_reg()
2070 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock_user_prot_reg() local
2072 if (!master->_lock_user_prot_reg) in mtd_lock_user_prot_reg()
2076 return master->_lock_user_prot_reg(master, from, len); in mtd_lock_user_prot_reg()
2082 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase_user_prot_reg() local
2084 if (!master->_erase_user_prot_reg) in mtd_erase_user_prot_reg()
2088 return master->_erase_user_prot_reg(master, from, len); in mtd_erase_user_prot_reg()
2095 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock() local
2097 if (!master->_lock) in mtd_lock()
2105 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_lock()
2106 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_lock()
2109 return master->_lock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_lock()
2115 struct mtd_info *master = mtd_get_master(mtd); in mtd_unlock() local
2117 if (!master->_unlock) in mtd_unlock()
2125 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_unlock()
2126 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_unlock()
2129 return master->_unlock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_unlock()
2135 struct mtd_info *master = mtd_get_master(mtd); in mtd_is_locked() local
2137 if (!master->_is_locked) in mtd_is_locked()
2145 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_is_locked()
2146 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_is_locked()
2149 return master->_is_locked(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_is_locked()
2155 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isreserved() local
2159 if (!master->_block_isreserved) in mtd_block_isreserved()
2163 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isreserved()
2165 return master->_block_isreserved(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isreserved()
2171 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isbad() local
2175 if (!master->_block_isbad) in mtd_block_isbad()
2179 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isbad()
2181 return master->_block_isbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isbad()
2187 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_markbad() local
2190 if (!master->_block_markbad) in mtd_block_markbad()
2198 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_markbad()
2200 ret = master->_block_markbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_markbad()
2259 struct mtd_info *master = mtd_get_master(mtd); in mtd_writev() local
2265 if (!master->_writev) in mtd_writev()
2268 return master->_writev(master, vecs, count, in mtd_writev()