]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
mtd: rawnand: Pass a nand_chip object to nand_scan()
authorBoris Brezillon <boris.brezillon@bootlin.com>
Thu, 6 Sep 2018 12:05:14 +0000 (14:05 +0200)
committerMiquel Raynal <miquel.raynal@bootlin.com>
Wed, 3 Oct 2018 09:12:25 +0000 (11:12 +0200)
Let's make the raw NAND API consistent by patching all helpers to take
a nand_chip object instead of an mtd_info one.

We start with nand_scan().

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
52 files changed:
Documentation/driver-api/mtdnand.rst
drivers/mtd/nand/raw/ams-delta.c
drivers/mtd/nand/raw/atmel/nand-controller.c
drivers/mtd/nand/raw/au1550nd.c
drivers/mtd/nand/raw/bcm47xxnflash/ops_bcm4706.c
drivers/mtd/nand/raw/brcmnand/brcmnand.c
drivers/mtd/nand/raw/cafe_nand.c
drivers/mtd/nand/raw/cmx270_nand.c
drivers/mtd/nand/raw/cs553x_nand.c
drivers/mtd/nand/raw/davinci_nand.c
drivers/mtd/nand/raw/denali.c
drivers/mtd/nand/raw/diskonchip.c
drivers/mtd/nand/raw/docg4.c
drivers/mtd/nand/raw/fsl_elbc_nand.c
drivers/mtd/nand/raw/fsl_ifc_nand.c
drivers/mtd/nand/raw/fsl_upm.c
drivers/mtd/nand/raw/fsmc_nand.c
drivers/mtd/nand/raw/gpio.c
drivers/mtd/nand/raw/gpmi-nand/gpmi-nand.c
drivers/mtd/nand/raw/hisi504_nand.c
drivers/mtd/nand/raw/jz4740_nand.c
drivers/mtd/nand/raw/jz4780_nand.c
drivers/mtd/nand/raw/lpc32xx_mlc.c
drivers/mtd/nand/raw/lpc32xx_slc.c
drivers/mtd/nand/raw/marvell_nand.c
drivers/mtd/nand/raw/mpc5121_nfc.c
drivers/mtd/nand/raw/mtk_nand.c
drivers/mtd/nand/raw/mxc_nand.c
drivers/mtd/nand/raw/nand_base.c
drivers/mtd/nand/raw/nandsim.c
drivers/mtd/nand/raw/ndfc.c
drivers/mtd/nand/raw/nuc900_nand.c
drivers/mtd/nand/raw/omap2.c
drivers/mtd/nand/raw/orion_nand.c
drivers/mtd/nand/raw/oxnas_nand.c
drivers/mtd/nand/raw/pasemi_nand.c
drivers/mtd/nand/raw/plat_nand.c
drivers/mtd/nand/raw/qcom_nandc.c
drivers/mtd/nand/raw/s3c2410.c
drivers/mtd/nand/raw/sh_flctl.c
drivers/mtd/nand/raw/sharpsl.c
drivers/mtd/nand/raw/sm_common.c
drivers/mtd/nand/raw/socrates_nand.c
drivers/mtd/nand/raw/sunxi_nand.c
drivers/mtd/nand/raw/tango_nand.c
drivers/mtd/nand/raw/tegra_nand.c
drivers/mtd/nand/raw/tmio_nand.c
drivers/mtd/nand/raw/txx9ndfmc.c
drivers/mtd/nand/raw/vf610_nfc.c
drivers/mtd/nand/raw/xway_nand.c
drivers/staging/mt29f_spinand/mt29f_spinand.c
include/linux/mtd/rawnand.h

index c55a6034c397d4e12fc80d064c3f730bc079cdc1..1ab6f35b6410822b3c1166b83ba841991dc54e4b 100644 (file)
@@ -246,7 +246,7 @@ necessary information about the device.
         this->eccmode = NAND_ECC_SOFT;
 
         /* Scan to find existence of the device */
-        if (nand_scan (board_mtd, 1)) {
+        if (nand_scan (this, 1)) {
             err = -ENXIO;
             goto out_ior;
         }
index 37a3cc21c7bccd396d92d6655e0004cd1aeddf6b..24ba7296ec08c7abb48a871bef47984415cf9e59 100644 (file)
@@ -235,7 +235,7 @@ static int ams_delta_init(struct platform_device *pdev)
                goto out_gpio;
 
        /* Scan to find existence of the device */
-       err = nand_scan(ams_delta_mtd, 1);
+       err = nand_scan(this, 1);
        if (err)
                goto out_mtd;
 
index 8b9e05ac24ee5c7b9c9add8bb1258a62f0cdde8e..cef22a79f3a63946d5b4f8d12967b54487e6189e 100644 (file)
@@ -1683,7 +1683,7 @@ atmel_nand_controller_add_nand(struct atmel_nand_controller *nc,
 
        nc->caps->ops->nand_init(nc, nand);
 
-       ret = nand_scan(mtd, nand->numcs);
+       ret = nand_scan(chip, nand->numcs);
        if (ret) {
                dev_err(nc->dev, "NAND scan failed: %d\n", ret);
                return ret;
index 32c0440141fb608cf30bb4c8c61c1a21183750bb..614f5d447ba567b37a94972ada35263a04ef609a 100644 (file)
@@ -451,7 +451,7 @@ static int au1550nd_probe(struct platform_device *pdev)
        this->write_buf = (pd->devwidth) ? au_write_buf16 : au_write_buf;
        this->read_buf = (pd->devwidth) ? au_read_buf16 : au_read_buf;
 
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(this, 1);
        if (ret) {
                dev_err(&pdev->dev, "NAND scan failed with %d\n", ret);
                goto out3;
index 60874de430eb7b743327f204d5d4cfcd6f770adf..9b62bc2d25a04d11e96812841f53bf1b99da206b 100644 (file)
@@ -423,7 +423,7 @@ int bcm47xxnflash_ops_bcm4706_init(struct bcm47xxnflash *b47n)
                        (w4 << 24 | w3 << 18 | w2 << 12 | w1 << 6 | w0));
 
        /* Scan NAND */
-       err = nand_scan(nand_to_mtd(&b47n->nand_chip), 1);
+       err = nand_scan(&b47n->nand_chip, 1);
        if (err) {
                pr_err("Could not scan NAND flash: %d\n", err);
                goto exit;
index 4b90d5b380c2503fc88426890f719bd018d6d2f7..a9a94c1026545079c98234ec2cd94a1dead79ddd 100644 (file)
@@ -2301,7 +2301,7 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
        nand_writereg(ctrl, cfg_offs,
                      nand_readreg(ctrl, cfg_offs) & ~CFG_BUS_WIDTH);
 
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(chip, 1);
        if (ret)
                return ret;
 
index 1dbe43adcfe7d550aabb31885a0f366e21cc6b1a..e497b95d624e22d953f577e200866e83a8a77909 100644 (file)
@@ -783,7 +783,7 @@ static int cafe_nand_probe(struct pci_dev *pdev,
 
        /* Scan to find existence of the device */
        cafe->nand.dummy_controller.ops = &cafe_nand_controller_ops;
-       err = nand_scan(mtd, 2);
+       err = nand_scan(&cafe->nand, 2);
        if (err)
                goto out_irq;
 
index b66e254b680281b4b951866ad9492473f8544f3d..e92c0f113eb3483cd4f1d998e3dd84c5d0cfe8e1 100644 (file)
@@ -193,7 +193,7 @@ static int __init cmx270_init(void)
        this->write_buf = cmx270_write_buf;
 
        /* Scan to find existence of the device */
-       ret = nand_scan(cmx270_nand_mtd, 1);
+       ret = nand_scan(this, 1);
        if (ret) {
                pr_notice("No NAND device\n");
                goto err_scan;
index beafad62e7d5007f4a2313cf1dd469b0fabf88f1..4065bcd12e64f7d4d6ff27385dd0b9c96e9740ed 100644 (file)
@@ -241,7 +241,7 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
        }
 
        /* Scan to find existence of the device */
-       err = nand_scan(new_mtd, 1);
+       err = nand_scan(this, 1);
        if (err)
                goto out_free;
 
index 40145e206a6b7a1d6c82de067c1e55069dd9a9d5..1021624195f7ac6b9e114c58eafadd0db33aeba3 100644 (file)
@@ -807,7 +807,7 @@ static int nand_davinci_probe(struct platform_device *pdev)
 
        /* Scan to find existence of the device(s) */
        info->chip.dummy_controller.ops = &davinci_nand_controller_ops;
-       ret = nand_scan(mtd, pdata->mask_chipsel ? 2 : 1);
+       ret = nand_scan(&info->chip, pdata->mask_chipsel ? 2 : 1);
        if (ret < 0) {
                dev_dbg(&pdev->dev, "no NAND chip(s) found\n");
                return ret;
index 177453dfaa079d1cd575590167aa626a7c15ade6..2e8a825c740e91fc044fdfc2388d8c7b8c8e0fae 100644 (file)
@@ -1355,7 +1355,7 @@ int denali_init(struct denali_nand_info *denali)
                chip->setup_data_interface = denali_setup_data_interface;
 
        chip->dummy_controller.ops = &denali_controller_ops;
-       ret = nand_scan(mtd, denali->max_banks);
+       ret = nand_scan(chip, denali->max_banks);
        if (ret)
                goto disable_irq;
 
index 3c46188dd6d2ba68a9b78bdd140dcdf1070fa800..9159748a2ef0c001123659b48f64d46d0fb0c55d 100644 (file)
@@ -1620,7 +1620,7 @@ static int __init doc_probe(unsigned long physadr)
        else
                numchips = doc2001_init(mtd);
 
-       if ((ret = nand_scan(mtd, numchips)) || (ret = doc->late_init(mtd))) {
+       if ((ret = nand_scan(nand, numchips)) || (ret = doc->late_init(mtd))) {
                /* DBB note: i believe nand_release is necessary here, as
                   buffers may have been allocated in nand_base.  Check with
                   Thomas. FIX ME! */
index 427fcbc1b71c0551a107b0d8734bdec808a792c4..69f60755f38a40ddadfe9654690a7daaf515f8e1 100644 (file)
@@ -1391,7 +1391,7 @@ static int __init probe_docg4(struct platform_device *pdev)
         * ->attach_chip callback.
         */
        nand->dummy_controller.ops = &docg4_controller_ops;
-       retval = nand_scan(mtd, 0);
+       retval = nand_scan(nand, 0);
        if (retval)
                goto free_nand;
 
index 55f449b711fd9fc4ad8ff2fc68f35524f37a481a..541343d142e06035d8ceb2af689afbffed92c166 100644 (file)
@@ -915,7 +915,7 @@ static int fsl_elbc_nand_probe(struct platform_device *pdev)
                goto err;
 
        priv->chip.controller->ops = &fsl_elbc_controller_ops;
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(&priv->chip, 1);
        if (ret)
                goto err;
 
index 7e7729df782780728826f1bd113bd1199d5a050b..ad010c72df789f11a119eb9ac0408df926ef5312 100644 (file)
@@ -1079,7 +1079,7 @@ static int fsl_ifc_nand_probe(struct platform_device *dev)
                goto err;
 
        priv->chip.controller->ops = &fsl_ifc_controller_ops;
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(&priv->chip, 1);
        if (ret)
                goto err;
 
index ca82727eca944ed4011e05eb2e31d976581c9fe4..99edae365d16b6def4977b2ce1a927cdd2a5acbc 100644 (file)
@@ -191,7 +191,7 @@ static int fun_chip_init(struct fsl_upm_nand *fun,
                goto err;
        }
 
-       ret = nand_scan(mtd, fun->mchip_count);
+       ret = nand_scan(&fun->chip, fun->mchip_count);
        if (ret)
                goto err;
 
index f418236fa020adfdbd502efbc494c8ef66f90154..9991e3b8e2376516244b94e9e776be9540e333b0 100644 (file)
@@ -1125,7 +1125,7 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
         * Scan to find existence of the device
         */
        nand->dummy_controller.ops = &fsmc_nand_controller_ops;
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(nand, 1);
        if (ret)
                goto release_dma_write_chan;
 
index 2780af26d9ab7db286d4d17b6c6e2ed165a192a6..983d3be4801935246b83551f550fc885472dd3b9 100644 (file)
@@ -289,7 +289,7 @@ static int gpio_nand_probe(struct platform_device *pdev)
        if (gpiomtd->nwp && !IS_ERR(gpiomtd->nwp))
                gpiod_direction_output(gpiomtd->nwp, 1);
 
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(chip, 1);
        if (ret)
                goto err_wp;
 
index 1c1ebbc82824362330fe307a67d4246fda2a03ed..7af207bc3ab5f11db3c8e06eba7eb0f91fc9619a 100644 (file)
@@ -1934,7 +1934,7 @@ static int gpmi_nand_init(struct gpmi_nand_data *this)
                goto err_out;
 
        chip->dummy_controller.ops = &gpmi_nand_controller_ops;
-       ret = nand_scan(mtd, GPMI_IS_MX6(this) ? 2 : 1);
+       ret = nand_scan(chip, GPMI_IS_MX6(this) ? 2 : 1);
        if (ret)
                goto err_out;
 
index 0f5c48aa5673435939f73c82d7e58fd66576a984..81baa2e6ae56ed37cdcf52af8628241b124abd42 100644 (file)
@@ -801,7 +801,7 @@ static int hisi_nfc_probe(struct platform_device *pdev)
        }
 
        chip->dummy_controller.ops = &hisi_nfc_controller_ops;
-       ret = nand_scan(mtd, max_chips);
+       ret = nand_scan(chip, max_chips);
        if (ret)
                return ret;
 
index a7515452bc5976c747b82ddd80c3f6618fbb4dec..75bb26645c8201aaf55e33493787336dbcb4027b 100644 (file)
@@ -331,7 +331,7 @@ static int jz_nand_detect_bank(struct platform_device *pdev,
 
        if (chipnr == 0) {
                /* Detect first chip. */
-               ret = nand_scan(mtd, 1);
+               ret = nand_scan(chip, 1);
                if (ret)
                        goto notfound_id;
 
index ac6239588f2621988d9b06316f78fbc3e5b8beaf..80f29b28bcc49e5268dbe0e057941d1a298bb339 100644 (file)
@@ -286,7 +286,7 @@ static int jz4780_nand_init_chip(struct platform_device *pdev,
        nand_set_flash_node(chip, np);
 
        chip->controller->ops = &jz4780_nand_controller_ops;
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(chip, 1);
        if (ret)
                return ret;
 
index e82abada130a057b0855f64b7f546026b529f0ad..453a83b82d73bf3aaf097cbd258be6f09730e5b8 100644 (file)
@@ -802,7 +802,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
         * SMALL block or LARGE block.
         */
        nand_chip->dummy_controller.ops = &lpc32xx_nand_controller_ops;
-       res = nand_scan(mtd, 1);
+       res = nand_scan(nand_chip, 1);
        if (res)
                goto free_irq;
 
index a4e8b7e7513516c91520814c49519e1259f8f779..ad6eff0591d2c11020d5b1fa227c64c66ff28bc1 100644 (file)
@@ -925,7 +925,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 
        /* Find NAND device */
        chip->dummy_controller.ops = &lpc32xx_nand_controller_ops;
-       res = nand_scan(mtd, 1);
+       res = nand_scan(chip, 1);
        if (res)
                goto release_dma;
 
index 270f281067ab11f418531ab2461bba6d00b78f2e..dde64609415ff0c320bde53b62a8cc7ff1384e13 100644 (file)
@@ -2605,7 +2605,7 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc,
 
        chip->options |= NAND_BUSWIDTH_AUTO;
 
-       ret = nand_scan(mtd, marvell_nand->nsels);
+       ret = nand_scan(chip, marvell_nand->nsels);
        if (ret) {
                dev_err(dev, "could not scan the nand chip\n");
                return ret;
index c0be9c30b4cfb3b786e0c9645323162c4319924f..efaaec462bd71ede353b7a53224a26243e7984f0 100644 (file)
@@ -767,7 +767,7 @@ static int mpc5121_nfc_probe(struct platform_device *op)
        }
 
        /* Detect NAND chips */
-       retval = nand_scan(mtd, be32_to_cpup(chips_no));
+       retval = nand_scan(chip, be32_to_cpup(chips_no));
        if (retval) {
                dev_err(dev, "NAND Flash not found !\n");
                goto error;
index 57b5ed1699e386e51865ba77c61c6561ffc1775f..7a2ce405f914ac32c1349cd431026f11c89a1676 100644 (file)
@@ -1365,7 +1365,7 @@ static int mtk_nfc_nand_chip_init(struct device *dev, struct mtk_nfc *nfc,
 
        mtk_nfc_hw_init(nfc);
 
-       ret = nand_scan(mtd, nsels);
+       ret = nand_scan(nand, nsels);
        if (ret)
                return ret;
 
index a0884a621053f562aedfe171bd7d85c84befd8cd..1ca03d88adf1530dd9c5c6b869516b24a1735da8 100644 (file)
@@ -1887,7 +1887,7 @@ static int mxcnd_probe(struct platform_device *pdev)
 
        /* Scan the NAND device */
        this->dummy_controller.ops = &mxcnd_controller_ops;
-       err = nand_scan(mtd, is_imx25_nfc(host) ? 4 : 1);
+       err = nand_scan(this, is_imx25_nfc(host) ? 4 : 1);
        if (err)
                goto escan;
 
index 306ef6ec41db66103f30b4e97d3e7750ee69d4c2..974cbfbde5e2ca6b9aeb6c0b2e411ca095e99e05 100644 (file)
@@ -5960,7 +5960,7 @@ static int nand_dt_init(struct nand_chip *chip)
 
 /**
  * nand_scan_ident - Scan for the NAND device
- * @mtd: MTD device structure
+ * @chip: NAND chip object
  * @maxchips: number of chips to scan for
  * @table: alternative NAND ID table
  *
@@ -5972,11 +5972,11 @@ static int nand_dt_init(struct nand_chip *chip)
  * prevented dynamic allocations during this phase which was unconvenient and
  * as been banned for the benefit of the ->init_ecc()/cleanup_ecc() hooks.
  */
-static int nand_scan_ident(struct mtd_info *mtd, int maxchips,
+static int nand_scan_ident(struct nand_chip *chip, int maxchips,
                           struct nand_flash_dev *table)
 {
+       struct mtd_info *mtd = nand_to_mtd(chip);
        int i, nand_maf_id, nand_dev_id;
-       struct nand_chip *chip = mtd_to_nand(mtd);
        int ret;
 
        /* Enforce the right timings for reset/detection */
@@ -6430,15 +6430,15 @@ static bool nand_ecc_strength_good(struct mtd_info *mtd)
 
 /**
  * nand_scan_tail - Scan for the NAND device
- * @mtd: MTD device structure
+ * @chip: NAND chip object
  *
  * This is the second phase of the normal nand_scan() function. It fills out
  * all the uninitialized function pointers with the defaults and scans for a
  * bad block table if appropriate.
  */
-static int nand_scan_tail(struct mtd_info *mtd)
+static int nand_scan_tail(struct nand_chip *chip)
 {
-       struct nand_chip *chip = mtd_to_nand(mtd);
+       struct mtd_info *mtd = nand_to_mtd(chip);
        struct nand_ecc_ctrl *ecc = &chip->ecc;
        int ret, i;
 
@@ -6777,7 +6777,7 @@ static void nand_detach(struct nand_chip *chip)
 
 /**
  * nand_scan_with_ids - [NAND Interface] Scan for the NAND device
- * @mtd: MTD device structure
+ * @chip: NAND chip object
  * @maxchips: number of chips to scan for. @nand_scan_ident() will not be run if
  *           this parameter is zero (useful for specific drivers that must
  *           handle this part of the process themselves, e.g docg4).
@@ -6787,14 +6787,13 @@ static void nand_detach(struct nand_chip *chip)
  * The flash ID is read and the mtd/chip structures are filled with the
  * appropriate values.
  */
-int nand_scan_with_ids(struct mtd_info *mtd, int maxchips,
+int nand_scan_with_ids(struct nand_chip *chip, int maxchips,
                       struct nand_flash_dev *ids)
 {
-       struct nand_chip *chip = mtd_to_nand(mtd);
        int ret;
 
        if (maxchips) {
-               ret = nand_scan_ident(mtd, maxchips, ids);
+               ret = nand_scan_ident(chip, maxchips, ids);
                if (ret)
                        return ret;
        }
@@ -6803,7 +6802,7 @@ int nand_scan_with_ids(struct mtd_info *mtd, int maxchips,
        if (ret)
                goto cleanup_ident;
 
-       ret = nand_scan_tail(mtd);
+       ret = nand_scan_tail(chip);
        if (ret)
                goto detach_chip;
 
index 47a81d1b1397ee8ddc2c08b91c019556b87c41fc..60761175e531ad6685a8d5f0cd353a0dbb402cd6 100644 (file)
@@ -2309,7 +2309,7 @@ static int __init ns_init_module(void)
                goto error;
 
        chip->dummy_controller.ops = &ns_controller_ops;
-       retval = nand_scan(nsmtd, 1);
+       retval = nand_scan(chip, 1);
        if (retval) {
                NS_ERR("Could not scan NAND Simulator device\n");
                goto error;
index b193f373f235b08a71b88a053effb040a8622542..7ce7f37dc67ad9937fbf1e515f5458a454bcfbbe 100644 (file)
@@ -181,7 +181,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
                goto err;
        }
 
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(chip, 1);
        if (ret)
                goto err;
 
index af5b32c9a791dc18934b916cec03573995bf307a..41ed993b9523b22924f6caf26ff20a24cd908fcc 100644 (file)
@@ -270,7 +270,7 @@ static int nuc900_nand_probe(struct platform_device *pdev)
 
        nuc900_nand_enable(nuc900_nand);
 
-       if (nand_scan(mtd, 1))
+       if (nand_scan(chip, 1))
                return -ENXIO;
 
        mtd_device_register(mtd, partitions, ARRAY_SIZE(partitions));
index 4546ac0bed4a0eb7435c8806c2323170327f61f3..c2aff2492fa1fec2cd342b65a46b4d698aedce9d 100644 (file)
@@ -2254,7 +2254,7 @@ static int omap_nand_probe(struct platform_device *pdev)
        /* scan NAND device connected to chip controller */
        nand_chip->options |= info->devsize & NAND_BUSWIDTH_16;
 
-       err = nand_scan(mtd, 1);
+       err = nand_scan(nand_chip, 1);
        if (err)
                goto return_error;
 
index 52d435285a3f393aa752838ff826415f0c1d154f..256a6b018bdc50d77a808dde57575571e7fb0d0f 100644 (file)
@@ -174,7 +174,7 @@ static int __init orion_nand_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(nc, 1);
        if (ret)
                goto no_dev;
 
index 01b00bb69c1e60889af64aaa8b461f085b447347..9aeb024c2a0ed00e90e76cc3b192e8f4100caba5 100644 (file)
@@ -142,7 +142,7 @@ static int oxnas_nand_probe(struct platform_device *pdev)
                chip->chip_delay = 30;
 
                /* Scan to find existence of the device */
-               err = nand_scan(mtd, 1);
+               err = nand_scan(chip, 1);
                if (err)
                        goto err_clk_unprepare;
 
index a47a7e4bd25aeba4a67ebe6e057278721299d2e5..eca4e41d2be3d33c5d045a9f11ce77d365dedecf 100644 (file)
@@ -156,7 +156,7 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
        chip->bbt_options = NAND_BBT_USE_FLASH;
 
        /* Scan to find existence of the device */
-       err = nand_scan(pasemi_nand_mtd, 1);
+       err = nand_scan(chip, 1);
        if (err)
                goto out_lpc;
 
index 24f904300c44f0cad6b5ff1b566bad87b0a9a651..c9a23fb2171879d6076e7e31919bbebc2c8072e1 100644 (file)
@@ -131,7 +131,7 @@ static int plat_nand_probe(struct platform_device *pdev)
        }
 
        /* Scan to find existence of the device */
-       err = nand_scan(mtd, pdata->chip.nr_chips);
+       err = nand_scan(&data->chip, pdata->chip.nr_chips);
        if (err)
                goto out;
 
index d2831b0b28fbad96ccfd9bb17a84ac1b50f93df2..d800347e74dad4d1c8b36bb610a01ed07a570cd8 100644 (file)
@@ -2834,7 +2834,7 @@ static int qcom_nand_host_init_and_register(struct qcom_nand_controller *nandc,
        /* set up initial status value */
        host->status = NAND_STATUS_READY | NAND_STATUS_WP;
 
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(chip, 1);
        if (ret)
                return ret;
 
index c21e8892394a3d9f2be39070c5dd9a44ec676fd6..7f30d801d6420c7ffefdc6a88d796f560bb38c35 100644 (file)
@@ -1170,7 +1170,7 @@ static int s3c24xx_nand_probe(struct platform_device *pdev)
                mtd->dev.parent = &pdev->dev;
                s3c2410_nand_init_chip(info, nmtd, sets);
 
-               err = nand_scan(mtd, sets ? sets->nr_chips : 1);
+               err = nand_scan(&nmtd->chip, sets ? sets->nr_chips : 1);
                if (err)
                        goto exit_error;
 
index ef3036d9bf156bdde0dc65b837e4738088ac9cbb..abcc3be89b898162fb2e01cbafe94fc38a507c8a 100644 (file)
@@ -1193,7 +1193,7 @@ static int flctl_probe(struct platform_device *pdev)
        flctl_setup_dma(flctl);
 
        nand->dummy_controller.ops = &flctl_nand_controller_ops;
-       ret = nand_scan(flctl_mtd, 1);
+       ret = nand_scan(nand, 1);
        if (ret)
                goto err_chip;
 
index fc171b17a39b8dce93587ba8315120162bc8012f..4afacb0dcf001ad279eb8b2e662c39b262aeba8a 100644 (file)
@@ -171,7 +171,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
        this->ecc.correct = nand_correct_data;
 
        /* Scan to find existence of the device */
-       err = nand_scan(mtd, 1);
+       err = nand_scan(this, 1);
        if (err)
                goto err_scan;
 
index 73aafe8c3ef34944db18e47bcffb49fec6995635..02ac6e9b2d1654e40cb133750820a29063257f9c 100644 (file)
@@ -195,7 +195,7 @@ int sm_register_device(struct mtd_info *mtd, int smartmedia)
        /* Scan for card properties */
        chip->dummy_controller.ops = &sm_controller_ops;
        flash_ids = smartmedia ? nand_smartmedia_flash_ids : nand_xd_flash_ids;
-       ret = nand_scan_with_ids(mtd, 1, flash_ids);
+       ret = nand_scan_with_ids(chip, 1, flash_ids);
        if (ret)
                return ret;
 
index 36c45aa21f663a6f7ad9836b53720409ed344e8d..e335560f87aff82903860e5f5ab559f5791cd9bc 100644 (file)
@@ -173,7 +173,7 @@ static int socrates_nand_probe(struct platform_device *ofdev)
 
        dev_set_drvdata(&ofdev->dev, host);
 
-       res = nand_scan(mtd, 1);
+       res = nand_scan(nand_chip, 1);
        if (res)
                goto out;
 
index 1f0b7ee38df5627acf1d0f675fc5d85abb7aea67..179f74b6edf6bb6962f47dd67e0fc74dbf857a44 100644 (file)
@@ -1940,7 +1940,7 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
        mtd = nand_to_mtd(nand);
        mtd->dev.parent = dev;
 
-       ret = nand_scan(mtd, nsels);
+       ret = nand_scan(nand, nsels);
        if (ret)
                return ret;
 
index 72698691727d607d42ad960630788d6f23dfbbf5..45beb87aec937513b087c355082fbf35d500c08d 100644 (file)
@@ -588,7 +588,7 @@ static int chip_init(struct device *dev, struct device_node *np)
        mtd_set_ooblayout(mtd, &tango_nand_ooblayout_ops);
        mtd->dev.parent = dev;
 
-       err = nand_scan(mtd, 1);
+       err = nand_scan(chip, 1);
        if (err)
                return err;
 
index 79da1efc88d1a98a5f33443a46e4a4348a478b2e..5dcee20e2a8c97c9b4cef7d2e146e7f5fe367504 100644 (file)
@@ -1119,7 +1119,7 @@ static int tegra_nand_chips_init(struct device *dev,
        chip->select_chip = tegra_nand_select_chip;
        chip->setup_data_interface = tegra_nand_setup_data_interface;
 
-       ret = nand_scan(mtd, 1);
+       ret = nand_scan(chip, 1);
        if (ret)
                return ret;
 
index dcaa924502de33a250a98ecf1ce38a79842daf89..6df499a239ae27bd0b6b84f1c19bd9915b7e5886 100644 (file)
@@ -436,7 +436,7 @@ static int tmio_probe(struct platform_device *dev)
        nand_chip->waitfunc = tmio_nand_wait;
 
        /* Scan to find existence of the device */
-       retval = nand_scan(mtd, 1);
+       retval = nand_scan(nand_chip, 1);
        if (retval)
                goto err_irq;
 
index 4d61a14fcb65cb011fa64b020aaa0e1a6cd7df18..169e8bcee61ecb47ec118238956bf8818634663a 100644 (file)
@@ -359,7 +359,7 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
                if (plat->wide_mask & (1 << i))
                        chip->options |= NAND_BUSWIDTH_16;
 
-               if (nand_scan(mtd, 1)) {
+               if (nand_scan(chip, 1)) {
                        kfree(txx9_priv->mtdname);
                        kfree(txx9_priv);
                        continue;
index 6f6dcbf9095b9b890943a7097bdbb86447cc5806..3b486f4ce8682527cb9ba35c2f9e697c61eac187 100644 (file)
@@ -892,7 +892,7 @@ static int vf610_nfc_probe(struct platform_device *pdev)
 
        /* Scan the NAND chip */
        chip->dummy_controller.ops = &vf610_nfc_controller_ops;
-       err = nand_scan(mtd, 1);
+       err = nand_scan(chip, 1);
        if (err)
                goto err_disable_clk;
 
index 9926b4e3d69d014d70bb9f48941e9bc3037cce77..e670d3b5a646309a5987d630312cf9cbae6d508b 100644 (file)
@@ -205,7 +205,7 @@ static int xway_nand_probe(struct platform_device *pdev)
                    | cs_flag, EBU_NAND_CON);
 
        /* Scan to find existence of the device */
-       err = nand_scan(mtd, 1);
+       err = nand_scan(&data->chip, 1);
        if (err)
                return err;
 
index 448478451c4c4563cadc90106836f07567255871..b50788b2d1d9f69922d043eef2194beb59a82d6f 100644 (file)
@@ -934,7 +934,7 @@ static int spinand_probe(struct spi_device *spi_nand)
        mtd_set_ooblayout(mtd, &spinand_oob_64_ops);
 #endif
 
-       if (nand_scan(mtd, 1))
+       if (nand_scan(chip, 1))
                return -ENXIO;
 
        return mtd_device_register(mtd, NULL, 0);
index 818cdc0a4dbbee2fda070276e1558fdc9b4ab219..733b228d94a5c3ceba2a35352401477de6de5ebf 100644 (file)
 #include <linux/of.h>
 #include <linux/types.h>
 
+struct nand_chip;
 struct nand_flash_dev;
 
 /* Scan and identify a NAND device */
-int nand_scan_with_ids(struct mtd_info *mtd, int max_chips,
+int nand_scan_with_ids(struct nand_chip *chip, int max_chips,
                       struct nand_flash_dev *ids);
 
-static inline int nand_scan(struct mtd_info *mtd, int max_chips)
+static inline int nand_scan(struct nand_chip *chip, int max_chips)
 {
-       return nand_scan_with_ids(mtd, max_chips, NULL);
+       return nand_scan_with_ids(chip, max_chips, NULL);
 }
 
 /* Internal helper for board drivers which need to override command function */