nanddev_mtd_erase(9)
β¨ nanddev_mtd_erase(9) β¨
okay bestie, welcome to the Kernel API Manual π
β we're doing the nanddev_mtd_erase(9) page today and honestly? it's a little icon, a tiny helper with big main character energy π
β¨ NAME β¨
nanddev_mtd_erase β the generic mtd->_erase() implementation for NAND devices, no cap π¦
πΈ SYNOPSIS πΈ
int nanddev_mtd_erase (struct mtd_info *mtd , struct erase_info *einfo );
π ARGUMENTS π
mtdβ the MTD device, literally the thing we're erasing stuff on π«Άeinfoβ the erase request itself, like the lil form you fill out to say "erase this pls" β¨
π¦ DESCRIPTION π¦
so this is a simple mtd->_erase implementation β it just loops over all the blocks that einfo is concerned with and calls nand->ops->erase on each one of them π lowkey does exactly what it says on the tin, and it ate π
β οΈ okay listen up, this part MATTERS: do not directly assign mtd->_erase to this helper, because there's no locking in here π like none. zero. Not the vibe.
NAND specialized layers should instead implement their own wrapper around nanddev_mtd_erase, taking the appropriate lock before calling nanddev_mtd_erase π that's the way, fr fr.
π RETURN π
0 in case of success, and a negative error code otherwise π (yes, that's the whole bit β short and sweet, iykyk)
β SEE ALSO β
Kernel file ./drivers/mtd/nand/core.c β go read it, it's giving lore π§
nand_check_erased_buf(9)nand_check_erased_ecc_chunk(9)nanddev_isbad(9)nanddev_markbad(9)nanddev_isreserved(9)nanddev_erase(9)nanddev_mtd_max_bad_blocks(9)nanddev_get_ecc_engine(9)nanddev_put_ecc_engine(9)nanddev_find_ecc_configuration(9)nanddev_ecc_engine_init(9)nanddev_ecc_engine_cleanup(9)nanddev_init(9)nanddev_cleanup(9)
mwah π that's the whole page β brought to you by ./drivers/mtd/nand, dated October 2026, and yes she's serving kernel-manual realness till the very last line πβ¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms