mtd: rawnand: Pass a nand_chip object to nand_release()
authorBoris Brezillon <boris.brezillon@bootlin.com>
Thu, 6 Sep 2018 12:05:15 +0000 (14:05 +0200)
committerSasha Levin <sashal@kernel.org>
Tue, 30 Jun 2020 19:38:36 +0000 (15:38 -0400)
[ Upstream commit 59ac276f22270fb2094910f9a734c17f41c25e70 ]

Let's make the raw NAND API consistent by patching all helpers to
take a nand_chip object instead of an mtd_info one.

Now is nand_release()'s turn.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
48 files changed:
drivers/mtd/nand/ams-delta.c
drivers/mtd/nand/atmel_nand.c
drivers/mtd/nand/au1550nd.c
drivers/mtd/nand/bcm47xxnflash/main.c
drivers/mtd/nand/bf5xx_nand.c
drivers/mtd/nand/brcmnand/brcmnand.c
drivers/mtd/nand/cafe_nand.c
drivers/mtd/nand/cmx270_nand.c
drivers/mtd/nand/cs553x_nand.c
drivers/mtd/nand/davinci_nand.c
drivers/mtd/nand/denali.c
drivers/mtd/nand/diskonchip.c
drivers/mtd/nand/docg4.c
drivers/mtd/nand/fsl_elbc_nand.c
drivers/mtd/nand/fsl_ifc_nand.c
drivers/mtd/nand/fsl_upm.c
drivers/mtd/nand/fsmc_nand.c
drivers/mtd/nand/gpio.c
drivers/mtd/nand/gpmi-nand/gpmi-nand.c
drivers/mtd/nand/hisi504_nand.c
drivers/mtd/nand/jz4740_nand.c
drivers/mtd/nand/jz4780_nand.c
drivers/mtd/nand/lpc32xx_mlc.c
drivers/mtd/nand/lpc32xx_slc.c
drivers/mtd/nand/mpc5121_nfc.c
drivers/mtd/nand/mtk_nand.c
drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/nandsim.c
drivers/mtd/nand/ndfc.c
drivers/mtd/nand/nuc900_nand.c
drivers/mtd/nand/omap2.c
drivers/mtd/nand/orion_nand.c
drivers/mtd/nand/pasemi_nand.c
drivers/mtd/nand/plat_nand.c
drivers/mtd/nand/pxa3xx_nand.c
drivers/mtd/nand/qcom_nandc.c
drivers/mtd/nand/r852.c
drivers/mtd/nand/s3c2410.c
drivers/mtd/nand/sh_flctl.c
drivers/mtd/nand/sharpsl.c
drivers/mtd/nand/socrates_nand.c
drivers/mtd/nand/sunxi_nand.c
drivers/mtd/nand/tmio_nand.c
drivers/mtd/nand/txx9ndfmc.c
drivers/mtd/nand/vf610_nfc.c
drivers/mtd/nand/xway_nand.c
include/linux/mtd/nand.h

index 78e12cc8bac2f5bc43cc54a7a809c8734571bad1..02ec2d183607f469d07111cf01247488877156f3 100644 (file)
@@ -264,7 +264,7 @@ static int ams_delta_cleanup(struct platform_device *pdev)
        void __iomem *io_base = platform_get_drvdata(pdev);
 
        /* Release resources, unregister device */
-       nand_release(ams_delta_mtd);
+       nand_release(mtd_to_nand(ams_delta_mtd));
 
        gpio_free_array(_mandatory_gpio, ARRAY_SIZE(_mandatory_gpio));
        gpio_free(AMS_DELTA_GPIO_PIN_NAND_RB);
index 68b9160108c9f114f6ea83e1cda5892923d0433d..45495bc1a70e2c94f0976c8d3e97167af87689bb 100644 (file)
@@ -2336,7 +2336,7 @@ static int atmel_nand_remove(struct platform_device *pdev)
        struct atmel_nand_host *host = platform_get_drvdata(pdev);
        struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
 
-       nand_release(mtd);
+       nand_release(&host->nand_chip);
 
        atmel_nand_disable(host);
 
index 9bf6d9915694e0cd69708fd0a3d4cc7f706968ae..a0e7789131dfc6ac0e3f73e6f1fa20b0ee10936c 100644 (file)
@@ -496,7 +496,7 @@ static int au1550nd_remove(struct platform_device *pdev)
        struct au1550nd_ctx *ctx = platform_get_drvdata(pdev);
        struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
-       nand_release(nand_to_mtd(&ctx->chip));
+       nand_release(&ctx->chip);
        iounmap(ctx->base);
        release_mem_region(r->start, 0x1000);
        kfree(ctx);
index fb31429b70a9a2428d45daee8e9c3c45b3f2b542..d79694160845760f03fa59a40173e348756e3418 100644 (file)
@@ -65,7 +65,7 @@ static int bcm47xxnflash_remove(struct platform_device *pdev)
 {
        struct bcm47xxnflash *nflash = platform_get_drvdata(pdev);
 
-       nand_release(nand_to_mtd(&nflash->nand_chip));
+       nand_release(&nflash->nand_chip);
 
        return 0;
 }
index 3962f55bd03492aef64b235f596c921cb8fe8681..020bb350a2db240c971d5d0b42c662ebafaabfe2 100644 (file)
@@ -688,7 +688,7 @@ static int bf5xx_nand_remove(struct platform_device *pdev)
         * and their partitions, then go through freeing the
         * resources used
         */
-       nand_release(nand_to_mtd(&info->chip));
+       nand_release(&info->chip);
 
        peripheral_free_list(bfin_nfc_pin_req);
        bf5xx_nand_dma_remove(info);
index 1291492a1cef1154461573af96eb350e580d5272..fbee81909d38a78f236f15949801eb542970e73d 100644 (file)
@@ -2595,7 +2595,7 @@ int brcmnand_remove(struct platform_device *pdev)
        struct brcmnand_host *host;
 
        list_for_each_entry(host, &ctrl->host_list, node)
-               nand_release(nand_to_mtd(&host->chip));
+               nand_release(&host->chip);
 
        clk_disable_unprepare(ctrl->clk);
 
index 0b0c93702abbd43c96b4e48eda148db9d36ddbee..c16e740c01c380201db9475c3f34d7e15f14c7f2 100644 (file)
@@ -825,7 +825,7 @@ static void cafe_nand_remove(struct pci_dev *pdev)
        /* Disable NAND IRQ in global IRQ mask register */
        cafe_writel(cafe, ~1 & cafe_readl(cafe, GLOBAL_IRQ_MASK), GLOBAL_IRQ_MASK);
        free_irq(pdev->irq, mtd);
-       nand_release(mtd);
+       nand_release(chip);
        free_rs(cafe->rs);
        pci_iounmap(pdev, cafe->mmio);
        dma_free_coherent(&cafe->pdev->dev,
index 49133783ca5363f723cb2b9983f02e6ef9ba6b40..b9667204e711a18b4a39ee41a7a0e408f3f271b8 100644 (file)
@@ -230,7 +230,7 @@ module_init(cmx270_init);
 static void __exit cmx270_cleanup(void)
 {
        /* Release resources, unregister device */
-       nand_release(cmx270_nand_mtd);
+       nand_release(mtd_to_nand(cmx270_nand_mtd));
 
        gpio_free(GPIO_NAND_RB);
        gpio_free(GPIO_NAND_CS);
index a65e4e0f57a1c87b7eee27ea98992ed8ff0a5c57..4779dfec3576f7f3dd63954ca455873e4f0b3daf 100644 (file)
@@ -339,7 +339,7 @@ static void __exit cs553x_cleanup(void)
                mmio_base = this->IO_ADDR_R;
 
                /* Release resources, unregister device */
-               nand_release(mtd);
+               nand_release(this);
                kfree(mtd->name);
                cs553x_mtd[i] = NULL;
 
index 27fa8b87cd5fc6a779e0509ce78c010527747268..c7f535676e49f0582c2c8e62230f83a46711c621 100644 (file)
@@ -840,7 +840,7 @@ static int nand_davinci_remove(struct platform_device *pdev)
                ecc4_busy = false;
        spin_unlock_irq(&davinci_nand_lock);
 
-       nand_release(nand_to_mtd(&info->chip));
+       nand_release(&info->chip);
 
        clk_disable_unprepare(info->clk);
 
index 0476ae8776d938b09e09371d73cca855b85d4665..982cbc7f412f4219e2dfd4e52faf0acc5e5ae003 100644 (file)
@@ -1655,7 +1655,7 @@ void denali_remove(struct denali_nand_info *denali)
         */
        int bufsize = mtd->writesize + mtd->oobsize;
 
-       nand_release(mtd);
+       nand_release(&denali->nand);
        denali_irq_cleanup(denali->irq, denali);
        dma_unmap_single(denali->dev, denali->buf.dma_buf, bufsize,
                         DMA_BIDIRECTIONAL);
index a023ab9e9cbf616501cf16309f1198b67fbcf867..b42d618553be8ff87445966c80460fa2d822427f 100644 (file)
@@ -1611,7 +1611,7 @@ static int __init doc_probe(unsigned long physadr)
                /* nand_release will call mtd_device_unregister, but we
                   haven't yet added it.  This is handled without incident by
                   mtd_device_unregister, as far as I can tell. */
-               nand_release(mtd);
+               nand_release(nand);
                kfree(nand);
                goto fail;
        }
@@ -1644,7 +1644,7 @@ static void release_nanddoc(void)
                doc = nand_get_controller_data(nand);
 
                nextmtd = doc->nextdoc;
-               nand_release(mtd);
+               nand_release(nand);
                iounmap(doc->virtadr);
                release_mem_region(doc->physadr, DOC_IOREMAP_LEN);
                kfree(nand);
index 7af2a3cd949eee9377a22a510cc15605cd1adf74..5798cd87f340bc023a13138a1a2fa1128dd2efc0 100644 (file)
@@ -1374,7 +1374,7 @@ static int __init probe_docg4(struct platform_device *pdev)
        return 0;
 
 fail:
-       nand_release(mtd); /* deletes partitions and mtd devices */
+       nand_release(nand); /* deletes partitions and mtd devices */
        free_bch(doc->bch);
        kfree(nand);
 
@@ -1387,7 +1387,7 @@ fail_unmap:
 static int __exit cleanup_docg4(struct platform_device *pdev)
 {
        struct docg4_priv *doc = platform_get_drvdata(pdev);
-       nand_release(doc->mtd);
+       nand_release(mtd_to_nand(doc->mtd));
        free_bch(doc->bch);
        kfree(mtd_to_nand(doc->mtd));
        iounmap(doc->virtadr);
index 113f76e599372d3d09526bdb4f95a3620ea45681..2fc4f2ab89ff5eecb505f740e2cdc4d8f5ec45af 100644 (file)
@@ -811,7 +811,7 @@ static int fsl_elbc_chip_remove(struct fsl_elbc_mtd *priv)
        struct fsl_elbc_fcm_ctrl *elbc_fcm_ctrl = priv->ctrl->nand;
        struct mtd_info *mtd = nand_to_mtd(&priv->chip);
 
-       nand_release(mtd);
+       nand_release(&priv->chip);
 
        kfree(mtd->name);
 
index 4c3b986dd74d1e4afd87c6d9aecb7f633d424f58..cf0fccb5908e7362e74028b8289498542ee65960 100644 (file)
@@ -918,7 +918,7 @@ static int fsl_ifc_chip_remove(struct fsl_ifc_mtd *priv)
 {
        struct mtd_info *mtd = nand_to_mtd(&priv->chip);
 
-       nand_release(mtd);
+       nand_release(&priv->chip);
 
        kfree(mtd->name);
 
index d85fa2555b6838b967ab3aee36f78360ec6ac321..0b4d2489cc7161fbfafc95619632addb2a0650fa 100644 (file)
@@ -326,7 +326,7 @@ static int fun_remove(struct platform_device *ofdev)
        struct mtd_info *mtd = nand_to_mtd(&fun->chip);
        int i;
 
-       nand_release(mtd);
+       nand_release(&fun->chip);
        kfree(mtd->name);
 
        for (i = 0; i < fun->mchip_count; i++) {
index d4f454a4b35e7e5ed8aff7a6d5a326c86d62032f..92737deb7845da49a6770882bb0ededcf661a4c3 100644 (file)
@@ -1038,7 +1038,7 @@ static int fsmc_nand_remove(struct platform_device *pdev)
        struct fsmc_nand_data *host = platform_get_drvdata(pdev);
 
        if (host) {
-               nand_release(nand_to_mtd(&host->nand));
+               nand_release(&host->nand);
 
                if (host->mode == USE_DMA_ACCESS) {
                        dma_release_channel(host->write_dma_chan);
index 6317f6836022e8cbcd144b8df10fc698524d793b..c7461ca1c1a69d116d53090d764483aa41b9c42b 100644 (file)
@@ -197,7 +197,7 @@ static int gpio_nand_remove(struct platform_device *pdev)
 {
        struct gpiomtd *gpiomtd = platform_get_drvdata(pdev);
 
-       nand_release(nand_to_mtd(&gpiomtd->nand_chip));
+       nand_release(&gpiomtd->nand_chip);
 
        if (gpio_is_valid(gpiomtd->plat.gpio_nwp))
                gpio_set_value(gpiomtd->plat.gpio_nwp, 0);
index d9dab42758590f903ce382edaf3df20a91157086..f4a99e91c25004fab9afe83e4c24b890528504a7 100644 (file)
@@ -1930,7 +1930,7 @@ static int gpmi_set_geometry(struct gpmi_nand_data *this)
 
 static void gpmi_nand_exit(struct gpmi_nand_data *this)
 {
-       nand_release(nand_to_mtd(&this->nand));
+       nand_release(&this->nand);
        gpmi_free_dma_buffer(this);
 }
 
index 9432546f4cd47051e742f03699c4f6058b4915c4..6c96d9d29a310b4ac0744d9b523112af67f4cd33 100644 (file)
@@ -823,7 +823,7 @@ static int hisi_nfc_probe(struct platform_device *pdev)
        return 0;
 
 err_mtd:
-       nand_release(mtd);
+       nand_release(chip);
 err_res:
        return ret;
 }
@@ -831,9 +831,8 @@ err_res:
 static int hisi_nfc_remove(struct platform_device *pdev)
 {
        struct hinfc_host *host = platform_get_drvdata(pdev);
-       struct mtd_info *mtd = nand_to_mtd(&host->chip);
 
-       nand_release(mtd);
+       nand_release(&host->chip);
 
        return 0;
 }
index 5551c36adbdf173b7df20629c36b065551f9d4ba..6f323858d51a16ca34e00c836f8beef56ee5fc4f 100644 (file)
@@ -499,7 +499,7 @@ static int jz_nand_probe(struct platform_device *pdev)
        return 0;
 
 err_nand_release:
-       nand_release(mtd);
+       nand_release(chip);
 err_unclaim_banks:
        while (chipnr--) {
                unsigned char bank = nand->banks[chipnr];
@@ -520,7 +520,7 @@ static int jz_nand_remove(struct platform_device *pdev)
        struct jz_nand *nand = platform_get_drvdata(pdev);
        size_t i;
 
-       nand_release(nand_to_mtd(&nand->chip));
+       nand_release(&nand->chip);
 
        /* Deassert and disable all chips */
        writel(0, nand->base + JZ_REG_NAND_CTRL);
index a39bb70175eea230cab2c3797f4750f075cfa755..e8aaf2543946c3189fa09d37ab836334ba475da6 100644 (file)
@@ -293,7 +293,7 @@ static int jz4780_nand_init_chip(struct platform_device *pdev,
 
        ret = mtd_device_register(mtd, NULL, 0);
        if (ret) {
-               nand_release(mtd);
+               nand_release(chip);
                return ret;
        }
 
@@ -308,7 +308,7 @@ static void jz4780_nand_cleanup_chips(struct jz4780_nand_controller *nfc)
 
        while (!list_empty(&nfc->chips)) {
                chip = list_first_entry(&nfc->chips, struct jz4780_nand_chip, chip_list);
-               nand_release(nand_to_mtd(&chip->chip));
+               nand_release(&chip->chip);
                list_del(&chip->chip_list);
        }
 }
index bc6e49af063a254bd68b7e9ff779b9b554447516..839f8f4ace9e674c6b4d1c7948c4265f7c0242ea 100644 (file)
@@ -805,7 +805,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
        if (!res)
                return res;
 
-       nand_release(mtd);
+       nand_release(nand_chip);
 
 err_exit4:
        free_irq(host->irq, host);
@@ -828,9 +828,8 @@ err_exit1:
 static int lpc32xx_nand_remove(struct platform_device *pdev)
 {
        struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
-       struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
 
-       nand_release(mtd);
+       nand_release(&host->nand_chip);
        free_irq(host->irq, host);
        if (use_dma)
                dma_release_channel(host->dma_chan);
index 8d3edc34958e7b356431c92b0b9ad43c89ac062c..0b5fa254ea60a1ec1fdc77d9f917e2ff57e6e2cc 100644 (file)
@@ -940,7 +940,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
        if (!res)
                return res;
 
-       nand_release(mtd);
+       nand_release(chip);
 
 err_exit3:
        dma_release_channel(host->dma_chan);
@@ -959,9 +959,8 @@ static int lpc32xx_nand_remove(struct platform_device *pdev)
 {
        uint32_t tmp;
        struct lpc32xx_nand_host *host = platform_get_drvdata(pdev);
-       struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
 
-       nand_release(mtd);
+       nand_release(&host->nand_chip);
        dma_release_channel(host->dma_chan);
 
        /* Force CE high */
index 7eacb2f545f50366cc8996d48d3f46aaf9ed195c..9662f8fe471379220ba25a05f2a2165442ac0a17 100644 (file)
@@ -827,7 +827,7 @@ static int mpc5121_nfc_remove(struct platform_device *op)
        struct device *dev = &op->dev;
        struct mtd_info *mtd = dev_get_drvdata(dev);
 
-       nand_release(mtd);
+       nand_release(mtd_to_nand(mtd));
        mpc5121_nfc_free(dev, mtd);
 
        return 0;
index ca95ae00215ecc00e66cd244185fdb08e4f90e7b..fadc755e55f82215e4b36f533ea7bf8f3c608115 100644 (file)
@@ -1327,7 +1327,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
        ret = mtd_device_parse_register(mtd, NULL, NULL, NULL, 0);
        if (ret) {
                dev_err(dev, "mtd parse partition error\n");
-               nand_release(mtd);
+               nand_release(nand);
                return ret;
        }
 
@@ -1450,7 +1450,7 @@ static int mtk_nfc_remove(struct platform_device *pdev)
        while (!list_empty(&nfc->chips)) {
                chip = list_first_entry(&nfc->chips, struct mtk_nfc_nand_chip,
                                        node);
-               nand_release(nand_to_mtd(&chip->nand));
+               nand_release(&chip->nand);
                list_del(&chip->node);
        }
 
index 5c44eb57885b99094f1ba42106ee767f6df79be7..deb3cbadbc519464c40237eda876327c4434c50e 100644 (file)
@@ -1838,7 +1838,7 @@ static int mxcnd_remove(struct platform_device *pdev)
 {
        struct mxc_nand_host *host = platform_get_drvdata(pdev);
 
-       nand_release(nand_to_mtd(&host->nand));
+       nand_release(&host->nand);
        if (host->clk_act)
                clk_disable_unprepare(host->clk);
 
index 5fb45161789ce012e928c8ec05f589465a33ca93..bdf40c090acdc93a8c57a406ed077d3d8c4dfcb0 100644 (file)
@@ -4941,12 +4941,12 @@ EXPORT_SYMBOL_GPL(nand_cleanup);
 /**
  * nand_release - [NAND Interface] Unregister the MTD device and free resources
  *               held by the NAND device
- * @mtd: MTD device structure
+ * @chip: NAND chip object
  */
-void nand_release(struct mtd_info *mtd)
+void nand_release(struct nand_chip *chip)
 {
-       mtd_device_unregister(mtd);
-       nand_cleanup(mtd_to_nand(mtd));
+       mtd_device_unregister(nand_to_mtd(chip));
+       nand_cleanup(chip);
 }
 EXPORT_SYMBOL_GPL(nand_release);
 
index 1eb934414eb5804978994a382dbb1d782ca59e53..fe593f2f1ec7d8184b24efe829c334442f3468da 100644 (file)
@@ -2394,7 +2394,7 @@ static int __init ns_init_module(void)
 
 err_exit:
        free_nandsim(nand);
-       nand_release(nsmtd);
+       nand_release(chip);
        for (i = 0;i < ARRAY_SIZE(nand->partitions); ++i)
                kfree(nand->partitions[i].name);
 error:
@@ -2417,7 +2417,7 @@ static void __exit ns_cleanup_module(void)
 
        nandsim_debugfs_remove(ns);
        free_nandsim(ns);    /* Free nandsim private resources */
-       nand_release(nsmtd); /* Unregister driver */
+       nand_release(chip); /* Unregister driver */
        for (i = 0;i < ARRAY_SIZE(ns->partitions); ++i)
                kfree(ns->partitions[i].name);
        kfree(mtd_to_nand(nsmtd));        /* Free other structures */
index 28e6118362f7ea8348d2bcdb1e74ee804f0b682a..d03b47d2664b0c99acbd259fe8f7358a910bb32d 100644 (file)
@@ -258,7 +258,7 @@ static int ndfc_remove(struct platform_device *ofdev)
        struct ndfc_controller *ndfc = dev_get_drvdata(&ofdev->dev);
        struct mtd_info *mtd = nand_to_mtd(&ndfc->chip);
 
-       nand_release(mtd);
+       nand_release(&ndfc->chip);
        kfree(mtd->name);
 
        return 0;
index 8f64011d32ef2a2791a0380b003c10ab3dc63f0b..f7f54b46f246b9105b18b331de74d64ade591599 100644 (file)
@@ -284,7 +284,7 @@ static int nuc900_nand_remove(struct platform_device *pdev)
 {
        struct nuc900_nand *nuc900_nand = platform_get_drvdata(pdev);
 
-       nand_release(nand_to_mtd(&nuc900_nand->chip));
+       nand_release(&nuc900_nand->chip);
        clk_disable(nuc900_nand->clk);
 
        return 0;
index f3a516b3f108a25c984cdd5170aa2ef392f29017..62c0ca437c91e7b2c8560d60d3d0febeab17192c 100644 (file)
@@ -2307,7 +2307,7 @@ static int omap_nand_remove(struct platform_device *pdev)
        }
        if (info->dma)
                dma_release_channel(info->dma);
-       nand_release(mtd);
+       nand_release(nand_chip);
        return 0;
 }
 
index af2f09135fb0e0d851b4f6c4da1cde70f53b182a..cfd53f0ba6c3168eceda7eaa7d2452d3637639ae 100644 (file)
@@ -167,7 +167,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
        mtd->name = "orion_nand";
        ret = mtd_device_register(mtd, board->parts, board->nr_parts);
        if (ret) {
-               nand_release(mtd);
+               nand_release(nc);
                goto no_dev;
        }
 
@@ -184,9 +184,8 @@ static int orion_nand_remove(struct platform_device *pdev)
 {
        struct orion_nand_info *info = platform_get_drvdata(pdev);
        struct nand_chip *chip = &info->chip;
-       struct mtd_info *mtd = nand_to_mtd(chip);
 
-       nand_release(mtd);
+       nand_release(chip);
 
        if (!IS_ERR(info->clk))
                clk_disable_unprepare(info->clk);
index 80c98eef44d90102ebcb28a3834f50ae44de90b0..3300e43e2cb9f60a5e2c4629e781e676f7249da1 100644 (file)
@@ -194,7 +194,7 @@ static int pasemi_nand_remove(struct platform_device *ofdev)
        chip = mtd_to_nand(pasemi_nand_mtd);
 
        /* Release resources, unregister device */
-       nand_release(pasemi_nand_mtd);
+       nand_release(chip);
 
        release_region(lpcctl, 4);
 
index 415a53a0deeb306bb5baeaf3f5ad6638fd41d103..245efb0f83e2672fb32100a73d53a921414939b9 100644 (file)
@@ -100,7 +100,7 @@ static int plat_nand_probe(struct platform_device *pdev)
        if (!err)
                return err;
 
-       nand_release(mtd);
+       nand_release(&data->chip);
 out:
        if (pdata->ctrl.remove)
                pdata->ctrl.remove(pdev);
@@ -115,7 +115,7 @@ static int plat_nand_remove(struct platform_device *pdev)
        struct plat_nand_data *data = platform_get_drvdata(pdev);
        struct platform_nand_data *pdata = dev_get_platdata(&pdev->dev);
 
-       nand_release(nand_to_mtd(&data->chip));
+       nand_release(&data->chip);
        if (pdata->ctrl.remove)
                pdata->ctrl.remove(pdev);
 
index 3b8911cd3a199d986ffa1c4b70857f5e104a0434..46f13f7e54da011c4dce170bc8177d5051909343 100644 (file)
@@ -1907,7 +1907,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
        clk_disable_unprepare(info->clk);
 
        for (cs = 0; cs < pdata->num_cs; cs++)
-               nand_release(nand_to_mtd(&info->host[cs]->chip));
+               nand_release(&info->host[cs]->chip);
        return 0;
 }
 
index 9f6c9a34b9eb6df30a607a73df520ddd9863ad14..1594770987fdb1528005ab87599781db4cb85dda 100644 (file)
@@ -2163,7 +2163,7 @@ static int qcom_nandc_probe(struct platform_device *pdev)
 
 err_cs_init:
        list_for_each_entry(host, &nandc->host_list, node)
-               nand_release(nand_to_mtd(&host->chip));
+               nand_release(&host->chip);
 err_setup:
        clk_disable_unprepare(nandc->aon_clk);
 err_aon_clk:
@@ -2180,7 +2180,7 @@ static int qcom_nandc_remove(struct platform_device *pdev)
        struct qcom_nand_host *host;
 
        list_for_each_entry(host, &nandc->host_list, node)
-               nand_release(nand_to_mtd(&host->chip));
+               nand_release(&host->chip);
 
        qcom_nandc_unalloc(nandc);
 
index fc9287af4614039d305362b579112bc9d90cab0a..2cfa54941395228f41b66a01d6bd96b9c0ae1b32 100644 (file)
@@ -656,7 +656,7 @@ static int r852_register_nand_device(struct r852_device *dev)
        dev->card_registred = 1;
        return 0;
 error3:
-       nand_release(mtd);
+       nand_release(dev->chip);
 error1:
        /* Force card redetect */
        dev->card_detected = 0;
@@ -675,7 +675,7 @@ static void r852_unregister_nand_device(struct r852_device *dev)
                return;
 
        device_remove_file(&mtd->dev, &dev_attr_media_type);
-       nand_release(mtd);
+       nand_release(dev->chip);
        r852_engine_disable(dev);
        dev->card_registred = 0;
 }
index d459c19d78de383c1c2a88a1bcda0d1301b3c003..be9c145b743c9c6b94703ee286f6284247dc0e4b 100644 (file)
@@ -768,7 +768,7 @@ static int s3c24xx_nand_remove(struct platform_device *pdev)
 
                for (mtdno = 0; mtdno < info->mtd_count; mtdno++, ptr++) {
                        pr_debug("releasing mtd %d (%p)\n", mtdno, ptr);
-                       nand_release(nand_to_mtd(&ptr->chip));
+                       nand_release(&ptr->chip);
                }
        }
 
index d6c013f93b8c020edbcbda4ba3c0bcff00c40ecd..31f98acdba073d230ec6476bbc6cd3cd1d5a96fe 100644 (file)
@@ -1229,7 +1229,7 @@ static int flctl_remove(struct platform_device *pdev)
        struct sh_flctl *flctl = platform_get_drvdata(pdev);
 
        flctl_release_dma(flctl);
-       nand_release(nand_to_mtd(&flctl->chip));
+       nand_release(&flctl->chip);
        pm_runtime_disable(&pdev->dev);
 
        return 0;
index 064ca1757589ac8d8cba8b536f72ff30632efcfe..70e28bfeb840fd2e9343612d2dceed7fd94c340c 100644 (file)
@@ -192,7 +192,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
        return 0;
 
 err_add:
-       nand_release(mtd);
+       nand_release(this);
 
 err_scan:
        iounmap(sharpsl->io);
@@ -210,7 +210,7 @@ static int sharpsl_nand_remove(struct platform_device *pdev)
        struct sharpsl_nand *sharpsl = platform_get_drvdata(pdev);
 
        /* Release resources, unregister device */
-       nand_release(nand_to_mtd(&sharpsl->chip));
+       nand_release(&sharpsl->chip);
 
        iounmap(sharpsl->io);
 
index 888fd314c62a234b7a43e3c922a3d4dbb14e36c9..f633ff1ebc0ab5069f313fb98afc8051a88323b1 100644 (file)
@@ -203,7 +203,7 @@ static int socrates_nand_probe(struct platform_device *ofdev)
        if (!res)
                return res;
 
-       nand_release(mtd);
+       nand_release(nand_chip);
 
 out:
        iounmap(host->io_base);
@@ -216,9 +216,8 @@ out:
 static int socrates_nand_remove(struct platform_device *ofdev)
 {
        struct socrates_nand_host *host = dev_get_drvdata(&ofdev->dev);
-       struct mtd_info *mtd = nand_to_mtd(&host->nand_chip);
 
-       nand_release(mtd);
+       nand_release(&host->nand_chip);
 
        iounmap(host->io_base);
 
index 886355bfa761744dfeb5b0434eadc5a2a735c3d7..ddf3e24cc2898d1d6064811a9a138561bb790b32 100644 (file)
@@ -2108,7 +2108,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
        ret = mtd_device_register(mtd, NULL, 0);
        if (ret) {
                dev_err(dev, "failed to register mtd device: %d\n", ret);
-               nand_release(mtd);
+               nand_release(nand);
                return ret;
        }
 
@@ -2147,7 +2147,7 @@ static void sunxi_nand_chips_cleanup(struct sunxi_nfc *nfc)
        while (!list_empty(&nfc->chips)) {
                chip = list_first_entry(&nfc->chips, struct sunxi_nand_chip,
                                        node);
-               nand_release(nand_to_mtd(&chip->nand));
+               nand_release(&chip->nand);
                sunxi_nand_ecc_cleanup(&chip->nand.ecc);
                list_del(&chip->node);
        }
index 08b30549ec0a0e61f3cd236102f77f6ad9e16097..1deb5229db15d45e0bf05c4f4077ab04d263aba0 100644 (file)
@@ -446,7 +446,7 @@ static int tmio_probe(struct platform_device *dev)
        if (!retval)
                return retval;
 
-       nand_release(mtd);
+       nand_release(nand_chip);
 
 err_irq:
        tmio_hw_stop(dev, tmio);
@@ -457,7 +457,7 @@ static int tmio_remove(struct platform_device *dev)
 {
        struct tmio_nand *tmio = platform_get_drvdata(dev);
 
-       nand_release(nand_to_mtd(&tmio->chip));
+       nand_release(&tmio->chip);
        tmio_hw_stop(dev, tmio);
        return 0;
 }
index 0a14fda2e41bf5ba8b9aec33eaf7e6cba56b70af..f2ba55b0a1e9daa29f8613eb306012a0037f7bd2 100644 (file)
@@ -390,7 +390,7 @@ static int __exit txx9ndfmc_remove(struct platform_device *dev)
                chip = mtd_to_nand(mtd);
                txx9_priv = nand_get_controller_data(chip);
 
-               nand_release(mtd);
+               nand_release(chip);
                kfree(txx9_priv->mtdname);
                kfree(txx9_priv);
        }
index ddc629e3f63a6ff026bfacab4388be5438f4ff72..ec004e0a94a32475c11f806b0fde12c4dba44e04 100644 (file)
@@ -795,7 +795,7 @@ static int vf610_nfc_remove(struct platform_device *pdev)
        struct mtd_info *mtd = platform_get_drvdata(pdev);
        struct vf610_nfc *nfc = mtd_to_nfc(mtd);
 
-       nand_release(mtd);
+       nand_release(mtd_to_nand(mtd));
        clk_disable_unprepare(nfc->clk);
        return 0;
 }
index 895101a5e686457c0dc63237efcb33a79c43a559..d374a0007960a8583e3058608d6d27210ab4dd48 100644 (file)
@@ -211,7 +211,7 @@ static int xway_nand_probe(struct platform_device *pdev)
 
        err = mtd_device_register(mtd, NULL, 0);
        if (err)
-               nand_release(mtd);
+               nand_release(&data->chip);
 
        return err;
 }
@@ -223,7 +223,7 @@ static int xway_nand_remove(struct platform_device *pdev)
 {
        struct xway_nand_data *data = platform_get_drvdata(pdev);
 
-       nand_release(nand_to_mtd(&data->chip));
+       nand_release(&data->chip);
 
        return 0;
 }
index d8905a229f34833a4336b0a69431a4a0a94bc76e..573e744223a24e1953ec2843ef36bcc92b9439e9 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/mtd/flashchip.h>
 #include <linux/mtd/bbm.h>
 
+struct nand_chip;
 struct mtd_info;
 struct nand_flash_dev;
 struct device_node;
@@ -39,7 +40,7 @@ int nand_scan_ident(struct mtd_info *mtd, int max_chips,
 int nand_scan_tail(struct mtd_info *mtd);
 
 /* Unregister the MTD device and free resources held by the NAND device */
-void nand_release(struct mtd_info *mtd);
+void nand_release(struct nand_chip *chip);
 
 /* Internal helper for board drivers which need to override command function */
 void nand_wait_ready(struct mtd_info *mtd);
@@ -219,9 +220,6 @@ enum nand_ecc_algo {
 #define NAND_CI_CELLTYPE_MSK   0x0C
 #define NAND_CI_CELLTYPE_SHIFT 2
 
-/* Keep gcc happy */
-struct nand_chip;
-
 /* ONFI features */
 #define ONFI_FEATURE_16_BIT_BUS                (1 << 0)
 #define ONFI_FEATURE_EXT_PARAM_PAGE    (1 << 7)