mtd: nand: make use of mtd_to_nand() in NAND drivers
[deliverable/linux.git] / drivers / mtd / nand / mpc5121_nfc.c
index 0fdfc42f75f819047a9aeebe115df30d0b137546..642c486ea3c2d381222eff077f98219fcb965bd2 100644 (file)
@@ -135,7 +135,7 @@ static void mpc5121_nfc_done(struct mtd_info *mtd);
 /* Read NFC register */
 static inline u16 nfc_read(struct mtd_info *mtd, uint reg)
 {
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = chip->priv;
 
        return in_be16(prv->regs + reg);
@@ -144,7 +144,7 @@ static inline u16 nfc_read(struct mtd_info *mtd, uint reg)
 /* Write NFC register */
 static inline void nfc_write(struct mtd_info *mtd, uint reg, u16 val)
 {
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = chip->priv;
 
        out_be16(prv->regs + reg, val);
@@ -214,7 +214,7 @@ static inline void mpc5121_nfc_send_read_status(struct mtd_info *mtd)
 static irqreturn_t mpc5121_nfc_irq(int irq, void *data)
 {
        struct mtd_info *mtd = data;
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = chip->priv;
 
        nfc_set(mtd, NFC_CONFIG1, NFC_INT_MASK);
@@ -226,7 +226,7 @@ static irqreturn_t mpc5121_nfc_irq(int irq, void *data)
 /* Wait for operation complete */
 static void mpc5121_nfc_done(struct mtd_info *mtd)
 {
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = chip->priv;
        int rv;
 
@@ -246,7 +246,7 @@ static void mpc5121_nfc_done(struct mtd_info *mtd)
 /* Do address cycle(s) */
 static void mpc5121_nfc_addr_cycle(struct mtd_info *mtd, int column, int page)
 {
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        u32 pagemask = chip->pagemask;
 
        if (column != -1) {
@@ -281,7 +281,7 @@ static void mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip)
 /* Init external chip select logic on ADS5121 board */
 static int ads5121_chipselect_init(struct mtd_info *mtd)
 {
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = chip->priv;
        struct device_node *dn;
 
@@ -303,7 +303,7 @@ static int ads5121_chipselect_init(struct mtd_info *mtd)
 /* Control chips select signal on ADS5121 board */
 static void ads5121_select_chip(struct mtd_info *mtd, int chip)
 {
-       struct nand_chip *nand = mtd->priv;
+       struct nand_chip *nand = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = nand->priv;
        u8 v;
 
@@ -333,7 +333,7 @@ static int mpc5121_nfc_dev_ready(struct mtd_info *mtd)
 static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command,
                                                        int column, int page)
 {
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = chip->priv;
 
        prv->column = (column >= 0) ? column : 0;
@@ -406,7 +406,7 @@ static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command,
 static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset,
                                                u8 *buffer, uint size, int wr)
 {
-       struct nand_chip *nand = mtd->priv;
+       struct nand_chip *nand = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = nand->priv;
        uint o, s, sbsize, blksize;
 
@@ -458,7 +458,7 @@ static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset,
 static void mpc5121_nfc_buf_copy(struct mtd_info *mtd, u_char *buf, int len,
                                                                        int wr)
 {
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = chip->priv;
        uint c = prv->column;
        uint l;
@@ -536,7 +536,7 @@ static u16 mpc5121_nfc_read_word(struct mtd_info *mtd)
  */
 static int mpc5121_nfc_read_hw_config(struct mtd_info *mtd)
 {
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = chip->priv;
        struct mpc512x_reset_module *rm;
        struct device_node *rmnode;
@@ -615,7 +615,7 @@ out:
 /* Free driver resources */
 static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
 {
-       struct nand_chip *chip = mtd->priv;
+       struct nand_chip *chip = mtd_to_nand(mtd);
        struct mpc5121_nfc_prv *prv = chip->priv;
 
        if (prv->clk)
This page took 0.025808 seconds and 5 git commands to generate.