Skip to content

Commit 9eba47d

Browse files
Boris BREZILLONcomputersforpeace
authored andcommitted
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>
1 parent 8005c49 commit 9eba47d

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎include/linux/mtd/nand.h‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,11 @@ struct nand_chip {
719719
void *priv;
720720
};
721721

722+
static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
723+
{
724+
return mtd->priv;
725+
}
726+
722727
/*
723728
* NAND Flash Manufacturer ID Codes
724729
*/

0 commit comments

Comments
 (0)