mtd: nand: add an mtd_to_nand() helper

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


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=9eba47ddd8fee8a21f45e6e1d707103f040d90c7
Commit:     9eba47ddd8fee8a21f45e6e1d707103f040d90c7
Parent:     8005c49d9aea74d382f474ce11afbbc7d7130bec
Author:     Boris BREZILLON <boris.brezillon at free-electrons.com>
AuthorDate: Mon Nov 16 14:37:35 2015 +0100
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Thu Nov 19 11:09:10 2015 -0800

    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 at free-electrons.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 include/linux/mtd/nand.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 5a9d1d4..a4839b3 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -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
  */



More information about the linux-mtd-cvs mailing list