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 c55a603..1ab6f35 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 37a3cc2..24ba729 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 8b9e05a..cef22a7 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 32c0440..614f5d4 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 60874de..9b62bc2 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 4b90d5b..a9a94c1 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 1dbe43a..e497b95 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 b66e254..e92c0f1 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 beafad6..4065bcd 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 40145e2..1021624 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 177453d..2e8a825 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 3c46188..9159748 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 427fcbc..69f6075 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 55f449b..541343d 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 7e7729d..ad010c7 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 ca82727..99edae3 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 f418236..9991e3b 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 2780af2..983d3be 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 1c1ebbc..7af207b 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 0f5c48a..81baa2e 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 a751545..75bb266 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 ac62395..80f29b2 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 e82abad..453a83b 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 a4e8b7e..ad6eff0 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 270f281..dde6460 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 c0be9c3..efaaec4 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 57b5ed1..7a2ce40 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 a0884a6..1ca03d8 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 306ef6e..974cbfb 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 47a81d1..6076117 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 b193f37..7ce7f37 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 af5b32c..41ed993 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 4546ac0..c2aff24 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 52d4352..256a6b0 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 01b00bb..9aeb024 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 a47a7e4..eca4e41 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 24f9043..c9a23fb 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 d2831b0..d800347 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 c21e889..7f30d80 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 ef3036d..abcc3be 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 fc171b1..4afacb0 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 73aafe8..02ac6e9 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 36c45aa..e335560 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 1f0b7ee..179f74b 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 7269869..45beb87 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 79da1ef..5dcee20 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 dcaa924..6df499a 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 4d61a14..169e8bc 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 6f6dcbf..3b486f4 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 9926b4e..e670d3b 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 4484784..b50788b 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 818cdc0..733b228 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 */