Lines Matching refs:master
439 struct mtd_info *master = mtd_get_master(mtd); in mtd_wunit_to_pairing_info() local
440 int npairs = mtd_wunit_per_eb(master) / mtd_pairing_groups(master); in mtd_wunit_to_pairing_info()
445 if (master->pairing && master->pairing->get_info) in mtd_wunit_to_pairing_info()
446 return master->pairing->get_info(master, wunit, info); in mtd_wunit_to_pairing_info()
482 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_info_to_wunit() local
483 int ngroups = mtd_pairing_groups(master); in mtd_pairing_info_to_wunit()
484 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_pairing_info_to_wunit()
490 if (master->pairing && master->pairing->get_wunit) in mtd_pairing_info_to_wunit()
491 return mtd->pairing->get_wunit(master, info); in mtd_pairing_info_to_wunit()
509 struct mtd_info *master = mtd_get_master(mtd); in mtd_pairing_groups() local
511 if (!master->pairing || !master->pairing->ngroups) in mtd_pairing_groups()
514 return master->pairing->ngroups; in mtd_pairing_groups()
574 struct mtd_info *master = mtd_get_master(mtd); in add_mtd_device() local
596 if (WARN_ON((!mtd->erasesize || !master->_erase) && in add_mtd_device()
609 (!mtd_is_partition(mtd) || master->type != MTD_MLCNANDFLASH || in add_mtd_device()
610 !master->pairing || master->_writev)) in add_mtd_device()
629 int ngroups = mtd_pairing_groups(master); in add_mtd_device()
632 mtd->size = (u64)mtd_div_by_eb(mtd->size, master) * in add_mtd_device()
775 mutex_init(&mtd->master.partitions_lock); in mtd_set_dev_defaults()
867 int mtd_device_unregister(struct mtd_info *master) in mtd_device_unregister() argument
871 if (master->_reboot) in mtd_device_unregister()
872 unregister_reboot_notifier(&master->reboot_notifier); in mtd_device_unregister()
874 err = del_mtd_partitions(master); in mtd_device_unregister()
878 if (!device_is_registered(&master->dev)) in mtd_device_unregister()
881 return del_mtd_device(master); in mtd_device_unregister()
984 struct mtd_info *master = mtd_get_master(mtd); in __get_mtd_device() local
987 if (!try_module_get(master->owner)) in __get_mtd_device()
990 if (master->_get_device) { in __get_mtd_device()
991 err = master->_get_device(mtd); in __get_mtd_device()
994 module_put(master->owner); in __get_mtd_device()
999 master->usecount++; in __get_mtd_device()
1059 struct mtd_info *master = mtd_get_master(mtd); in __put_mtd_device() local
1067 master->usecount--; in __put_mtd_device()
1069 if (master->_put_device) in __put_mtd_device()
1070 master->_put_device(master); in __put_mtd_device()
1072 module_put(master->owner); in __put_mtd_device()
1083 struct mtd_info *master = mtd_get_master(mtd); in mtd_erase() local
1091 if (!mtd->erasesize || !master->_erase) in mtd_erase()
1106 master->erasesize; in mtd_erase()
1108 master->erasesize) - in mtd_erase()
1114 ret = master->_erase(master, &adjinstr); in mtd_erase()
1120 master); in mtd_erase()
1135 struct mtd_info *master = mtd_get_master(mtd); in mtd_point() local
1141 if (!master->_point) in mtd_point()
1149 return master->_point(master, from, len, retlen, virt, phys); in mtd_point()
1156 struct mtd_info *master = mtd_get_master(mtd); in mtd_unpoint() local
1158 if (!master->_unpoint) in mtd_unpoint()
1164 return master->_unpoint(master, mtd_get_master_ofs(mtd, from), len); in mtd_unpoint()
1191 static void mtd_update_ecc_stats(struct mtd_info *mtd, struct mtd_info *master, in mtd_update_ecc_stats() argument
1196 if (master == mtd) in mtd_update_ecc_stats()
1199 diff = master->ecc_stats; in mtd_update_ecc_stats()
1252 struct mtd_info *master = mtd_get_master(mtd); in mtd_panic_write() local
1255 if (!master->_panic_write) in mtd_panic_write()
1263 if (!master->oops_panic_write) in mtd_panic_write()
1264 master->oops_panic_write = true; in mtd_panic_write()
1266 return master->_panic_write(master, mtd_get_master_ofs(mtd, to), len, in mtd_panic_write()
1307 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob_std() local
1311 if (master->_read_oob) in mtd_read_oob_std()
1312 ret = master->_read_oob(master, from, ops); in mtd_read_oob_std()
1314 ret = master->_read(master, from, ops->len, &ops->retlen, in mtd_read_oob_std()
1323 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob_std() local
1327 if (master->_write_oob) in mtd_write_oob_std()
1328 ret = master->_write_oob(master, to, ops); in mtd_write_oob_std()
1330 ret = master->_write(master, to, ops->len, &ops->retlen, in mtd_write_oob_std()
1339 struct mtd_info *master = mtd_get_master(mtd); in mtd_io_emulated_slc() local
1340 int ngroups = mtd_pairing_groups(master); in mtd_io_emulated_slc()
1341 int npairs = mtd_wunit_per_eb(master) / ngroups; in mtd_io_emulated_slc()
1350 base = (loff_t)mtd_div_by_eb(start, mtd) * master->erasesize; in mtd_io_emulated_slc()
1361 base += master->erasesize; in mtd_io_emulated_slc()
1364 wunit = mtd_pairing_info_to_wunit(master, &info); in mtd_io_emulated_slc()
1401 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_oob() local
1402 struct mtd_ecc_stats old_stats = master->ecc_stats; in mtd_read_oob()
1414 if (!master->_read_oob && (!master->_read || ops->oobbuf)) in mtd_read_oob()
1422 mtd_update_ecc_stats(mtd, master, &old_stats); in mtd_read_oob()
1441 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_oob() local
1456 if (!master->_write_oob && (!master->_write || ops->oobbuf)) in mtd_write_oob()
1485 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_ecc() local
1489 if (!master || section < 0) in mtd_ooblayout_ecc()
1492 if (!master->ooblayout || !master->ooblayout->ecc) in mtd_ooblayout_ecc()
1495 return master->ooblayout->ecc(master, section, oobecc); in mtd_ooblayout_ecc()
1519 struct mtd_info *master = mtd_get_master(mtd); in mtd_ooblayout_free() local
1523 if (!master || section < 0) in mtd_ooblayout_free()
1526 if (!master->ooblayout || !master->ooblayout->free) in mtd_ooblayout_free()
1529 return master->ooblayout->free(master, section, oobfree); in mtd_ooblayout_free()
1838 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_fact_prot_info() local
1840 if (!master->_get_fact_prot_info) in mtd_get_fact_prot_info()
1844 return master->_get_fact_prot_info(master, len, retlen, buf); in mtd_get_fact_prot_info()
1851 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_fact_prot_reg() local
1854 if (!master->_read_fact_prot_reg) in mtd_read_fact_prot_reg()
1858 return master->_read_fact_prot_reg(master, from, len, retlen, buf); in mtd_read_fact_prot_reg()
1865 struct mtd_info *master = mtd_get_master(mtd); in mtd_get_user_prot_info() local
1867 if (!master->_get_user_prot_info) in mtd_get_user_prot_info()
1871 return master->_get_user_prot_info(master, len, retlen, buf); in mtd_get_user_prot_info()
1878 struct mtd_info *master = mtd_get_master(mtd); in mtd_read_user_prot_reg() local
1881 if (!master->_read_user_prot_reg) in mtd_read_user_prot_reg()
1885 return master->_read_user_prot_reg(master, from, len, retlen, buf); in mtd_read_user_prot_reg()
1892 struct mtd_info *master = mtd_get_master(mtd); in mtd_write_user_prot_reg() local
1896 if (!master->_write_user_prot_reg) in mtd_write_user_prot_reg()
1900 ret = master->_write_user_prot_reg(master, to, len, retlen, buf); in mtd_write_user_prot_reg()
1914 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock_user_prot_reg() local
1916 if (!master->_lock_user_prot_reg) in mtd_lock_user_prot_reg()
1920 return master->_lock_user_prot_reg(master, from, len); in mtd_lock_user_prot_reg()
1927 struct mtd_info *master = mtd_get_master(mtd); in mtd_lock() local
1929 if (!master->_lock) in mtd_lock()
1937 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_lock()
1938 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_lock()
1941 return master->_lock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_lock()
1947 struct mtd_info *master = mtd_get_master(mtd); in mtd_unlock() local
1949 if (!master->_unlock) in mtd_unlock()
1957 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_unlock()
1958 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_unlock()
1961 return master->_unlock(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_unlock()
1967 struct mtd_info *master = mtd_get_master(mtd); in mtd_is_locked() local
1969 if (!master->_is_locked) in mtd_is_locked()
1977 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_is_locked()
1978 len = (u64)mtd_div_by_eb(len, mtd) * master->erasesize; in mtd_is_locked()
1981 return master->_is_locked(master, mtd_get_master_ofs(mtd, ofs), len); in mtd_is_locked()
1987 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isreserved() local
1991 if (!master->_block_isreserved) in mtd_block_isreserved()
1995 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isreserved()
1997 return master->_block_isreserved(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isreserved()
2003 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_isbad() local
2007 if (!master->_block_isbad) in mtd_block_isbad()
2011 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_isbad()
2013 return master->_block_isbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_isbad()
2019 struct mtd_info *master = mtd_get_master(mtd); in mtd_block_markbad() local
2022 if (!master->_block_markbad) in mtd_block_markbad()
2030 ofs = (loff_t)mtd_div_by_eb(ofs, mtd) * master->erasesize; in mtd_block_markbad()
2032 ret = master->_block_markbad(master, mtd_get_master_ofs(mtd, ofs)); in mtd_block_markbad()
2091 struct mtd_info *master = mtd_get_master(mtd); in mtd_writev() local
2097 if (!master->_writev) in mtd_writev()
2100 return master->_writev(master, vecs, count, in mtd_writev()