]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blobdiff - drivers/mtd/nand/bcm47xxnflash/ops_bcm4706.c
mtd: nand: make use of mtd_to_nand() in NAND drivers
[mirror_ubuntu-focal-kernel.git] / drivers / mtd / nand / bcm47xxnflash / ops_bcm4706.c
index 592befc7ffa1229cb121452e20c64a78f4dec903..e5b2e48658c4d1fb038d1d9f551ca92d4a12697c 100644 (file)
@@ -89,7 +89,7 @@ static int bcm47xxnflash_ops_bcm4706_poll(struct bcma_drv_cc *cc)
 static void bcm47xxnflash_ops_bcm4706_read(struct mtd_info *mtd, uint8_t *buf,
                                           int len)
 {
-       struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *nand_chip = mtd_to_nand(mtd);
        struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
 
        u32 ctlcode;
@@ -139,7 +139,7 @@ static void bcm47xxnflash_ops_bcm4706_read(struct mtd_info *mtd, uint8_t *buf,
 static void bcm47xxnflash_ops_bcm4706_write(struct mtd_info *mtd,
                                            const uint8_t *buf, int len)
 {
-       struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *nand_chip = mtd_to_nand(mtd);
        struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
        struct bcma_drv_cc *cc = b47n->cc;
 
@@ -173,7 +173,7 @@ static void bcm47xxnflash_ops_bcm4706_write(struct mtd_info *mtd,
 static void bcm47xxnflash_ops_bcm4706_cmd_ctrl(struct mtd_info *mtd, int cmd,
                                               unsigned int ctrl)
 {
-       struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *nand_chip = mtd_to_nand(mtd);
        struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
        u32 code = 0;
 
@@ -199,7 +199,7 @@ static void bcm47xxnflash_ops_bcm4706_select_chip(struct mtd_info *mtd,
 
 static int bcm47xxnflash_ops_bcm4706_dev_ready(struct mtd_info *mtd)
 {
-       struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *nand_chip = mtd_to_nand(mtd);
        struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
 
        return !!(bcma_cc_read32(b47n->cc, BCMA_CC_NFLASH_CTL) & NCTL_READY);
@@ -216,7 +216,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd,
                                              unsigned command, int column,
                                              int page_addr)
 {
-       struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *nand_chip = mtd_to_nand(mtd);
        struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
        struct bcma_drv_cc *cc = b47n->cc;
        u32 ctlcode;
@@ -312,7 +312,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd,
 
 static u8 bcm47xxnflash_ops_bcm4706_read_byte(struct mtd_info *mtd)
 {
-       struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *nand_chip = mtd_to_nand(mtd);
        struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
        struct bcma_drv_cc *cc = b47n->cc;
        u32 tmp = 0;
@@ -341,7 +341,7 @@ static u8 bcm47xxnflash_ops_bcm4706_read_byte(struct mtd_info *mtd)
 static void bcm47xxnflash_ops_bcm4706_read_buf(struct mtd_info *mtd,
                                               uint8_t *buf, int len)
 {
-       struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *nand_chip = mtd_to_nand(mtd);
        struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
 
        switch (b47n->curr_command) {
@@ -357,7 +357,7 @@ static void bcm47xxnflash_ops_bcm4706_read_buf(struct mtd_info *mtd,
 static void bcm47xxnflash_ops_bcm4706_write_buf(struct mtd_info *mtd,
                                                const uint8_t *buf, int len)
 {
-       struct nand_chip *nand_chip = (struct nand_chip *)mtd->priv;
+       struct nand_chip *nand_chip = mtd_to_nand(mtd);
        struct bcm47xxnflash *b47n = (struct bcm47xxnflash *)nand_chip->priv;
 
        switch (b47n->curr_command) {