mtd: nand: make use of nand_set/get_controller_data() helpers
[deliverable/linux.git] / drivers / mtd / nand / mpc5121_nfc.c
index 6d0ca33dd7abc5a4e72b0b5091eca0424103f3dd..6b93e899d4e95faf9372689bb290ec0d22b946e6 100644 (file)
@@ -135,7 +135,7 @@ static void mpc5121_nfc_done(struct mtd_info *mtd);
 static inline u16 nfc_read(struct mtd_info *mtd, uint reg)
 {
        struct nand_chip *chip = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = chip->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
 
        return in_be16(prv->regs + reg);
 }
@@ -144,7 +144,7 @@ static inline u16 nfc_read(struct mtd_info *mtd, uint reg)
 static inline void nfc_write(struct mtd_info *mtd, uint reg, u16 val)
 {
        struct nand_chip *chip = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = chip->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
 
        out_be16(prv->regs + reg, val);
 }
@@ -214,7 +214,7 @@ static irqreturn_t mpc5121_nfc_irq(int irq, void *data)
 {
        struct mtd_info *mtd = data;
        struct nand_chip *chip = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = chip->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
 
        nfc_set(mtd, NFC_CONFIG1, NFC_INT_MASK);
        wake_up(&prv->irq_waitq);
@@ -226,7 +226,7 @@ static irqreturn_t mpc5121_nfc_irq(int irq, void *data)
 static void mpc5121_nfc_done(struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = chip->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
        int rv;
 
        if ((nfc_read(mtd, NFC_CONFIG2) & NFC_INT) == 0) {
@@ -281,7 +281,7 @@ static void mpc5121_nfc_select_chip(struct mtd_info *mtd, int chip)
 static int ads5121_chipselect_init(struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = chip->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
        struct device_node *dn;
 
        dn = of_find_compatible_node(NULL, NULL, "fsl,mpc5121ads-cpld");
@@ -303,7 +303,7 @@ static int ads5121_chipselect_init(struct mtd_info *mtd)
 static void ads5121_select_chip(struct mtd_info *mtd, int chip)
 {
        struct nand_chip *nand = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = nand->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(nand);
        u8 v;
 
        v = in_8(prv->csreg);
@@ -333,7 +333,7 @@ static void mpc5121_nfc_command(struct mtd_info *mtd, unsigned command,
                                                        int column, int page)
 {
        struct nand_chip *chip = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = chip->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
 
        prv->column = (column >= 0) ? column : 0;
        prv->spareonly = 0;
@@ -406,7 +406,7 @@ static void mpc5121_nfc_copy_spare(struct mtd_info *mtd, uint offset,
                                                u8 *buffer, uint size, int wr)
 {
        struct nand_chip *nand = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = nand->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(nand);
        uint o, s, sbsize, blksize;
 
        /*
@@ -458,7 +458,7 @@ static void mpc5121_nfc_buf_copy(struct mtd_info *mtd, u_char *buf, int len,
                                                                        int wr)
 {
        struct nand_chip *chip = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = chip->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
        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_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = chip->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
        struct mpc512x_reset_module *rm;
        struct device_node *rmnode;
        uint rcw_pagesize = 0;
@@ -615,7 +615,7 @@ out:
 static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd_to_nand(mtd);
-       struct mpc5121_nfc_prv *prv = chip->priv;
+       struct mpc5121_nfc_prv *prv = nand_get_controller_data(chip);
 
        if (prv->clk)
                clk_disable_unprepare(prv->clk);
@@ -657,7 +657,7 @@ static int mpc5121_nfc_probe(struct platform_device *op)
        mtd = nand_to_mtd(chip);
 
        mtd->dev.parent = dev;
-       chip->priv = prv;
+       nand_set_controller_data(chip, prv);
        nand_set_flash_node(chip, dn);
        prv->dev = dev;
 
This page took 0.043376 seconds and 5 git commands to generate.