mtd: nand: add an mtd_to_nand() helper

Some drivers are retrieving the nand_chip pointer using the container_of
macro on a struct wrapping both the nand_chip and the mtd_info struct while
the standard way of retrieving this pointer is through mtd->priv.
Provide an helper to do that.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
This commit is contained in:
Boris BREZILLON 2015-11-16 14:37:35 +01:00 committed by Brian Norris
parent 8005c49d9a
commit 9eba47ddd8
1 changed files with 5 additions and 0 deletions

View File

@ -719,6 +719,11 @@ struct nand_chip {
void *priv;
};
static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
{
return mtd->priv;
}
/*
* NAND Flash Manufacturer ID Codes
*/