mtd: nand: update mtd_to_nand()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Tue Jan 12 15:59:26 PST 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2d3b77bac34bf99d7fdfd712ec2dc4317b3e850b
Commit:     2d3b77bac34bf99d7fdfd712ec2dc4317b3e850b
Parent:     442f201b93b5222ac2e4f7513be86fdbd00e9065
Author:     Boris BREZILLON <boris.brezillon at free-electrons.com>
AuthorDate: Thu Dec 10 09:00:33 2015 +0100
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Dec 18 13:19:10 2015 -0800

    mtd: nand: update mtd_to_nand()
    
    Now that all drivers are using the mtd instance embedded in the nand_chip
    struct we can safely update the mtd_to_nand() implementation to use
    the container_of macro instead of returning the content of mtd->priv.
    This will allow us to remove mtd->priv = chip assignments done in all
    NAND controller drivers.
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 include/linux/mtd/nand.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index b614ed2..9cb7ace 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -734,7 +734,7 @@ static inline struct device_node *nand_get_flash_node(struct nand_chip *chip)
 
 static inline struct nand_chip *mtd_to_nand(struct mtd_info *mtd)
 {
-	return mtd->priv;
+	return container_of(mtd, struct nand_chip, mtd);
 }
 
 static inline struct mtd_info *nand_to_mtd(struct nand_chip *chip)



More information about the linux-mtd-cvs mailing list