Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Boris BREZILLON and committed by
Brian Norris
9eba47dd 8005c49d

+5
+5
include/linux/mtd/nand.h
··· 719 719 void *priv; 720 720 }; 721 721 722 + static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd) 723 + { 724 + return mtd->priv; 725 + } 726 + 722 727 /* 723 728 * NAND Flash Manufacturer ID Codes 724 729 */