staging: mt29f_spinand: make use of mtd_to_nand()
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Tue, 1 Dec 2015 11:03:05 +0000 (12:03 +0100)
committerBrian Norris <computersforpeace@gmail.com>
Tue, 8 Dec 2015 18:47:28 +0000 (10:47 -0800)
mtd_to_nand() was recently introduced to avoid direct accesses to the
mtd->priv field. Use it where appropriate.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/staging/mt29f_spinand/mt29f_spinand.c

index 6536066b23490ac91e8504ddc71fab0e6f383b98..8924a9645a43608551ccef6f37d609b159c75b02 100644 (file)
@@ -31,7 +31,7 @@
 
 static inline struct spinand_state *mtd_to_state(struct mtd_info *mtd)
 {
-       struct nand_chip *chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct spinand_info *info = (struct spinand_info *)chip->priv;
        struct spinand_state *state = (struct spinand_state *)info->priv;
 
@@ -744,7 +744,7 @@ static void spinand_reset(struct spi_device *spi_nand)
 static void spinand_cmdfunc(struct mtd_info *mtd, unsigned int command,
                            int column, int page)
 {
-       struct nand_chip *chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct spinand_info *info = (struct spinand_info *)chip->priv;
        struct spinand_state *state = (struct spinand_state *)info->priv;