mtd: nand: remove useless mtd->priv = chip assignments
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Thu, 10 Dec 2015 08:00:34 +0000 (09:00 +0100)
committerBrian Norris <computersforpeace@gmail.com>
Fri, 18 Dec 2015 21:21:40 +0000 (13:21 -0800)
mtd_to_nand() now uses the container_of() approach to transform an
mtd_info pointer into a nand_chip one. Drop useless mtd->priv
assignments from NAND controller drivers.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
42 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/lpc32xx_mlc.c
drivers/mtd/nand/lpc32xx_slc.c
drivers/mtd/nand/mpc5121_nfc.c
drivers/mtd/nand/mxc_nand.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/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

index 0f638c628a0d58738492468ecc97896ec7330a1e..1a18938565ac81416dcf6a3635d843163f6be7ad 100644 (file)
@@ -193,9 +193,6 @@ static int ams_delta_init(struct platform_device *pdev)
        ams_delta_mtd = nand_to_mtd(this);
        ams_delta_mtd->owner = THIS_MODULE;
 
-       /* Link the private data with the MTD structure */
-       ams_delta_mtd->priv = this;
-
        /*
         * Don't try to request the memory region from here,
         * it should have been already requested from the
index 9ba2831277eaaada0b0738d41eb23ab9f271c959..18c4e14ec29f619bc0bd75c880054461b463eb3d 100644 (file)
@@ -2128,7 +2128,6 @@ static int atmel_nand_probe(struct platform_device *pdev)
        }
 
        nand_chip->priv = host;         /* link the private data structures */
-       mtd->priv = nand_chip;
        mtd->dev.parent = &pdev->dev;
 
        /* Set address of NAND IO lines */
index 280e5b61b815a744b7dc11bd9e89d7e3087f5566..341ea4904164dec5dcfebac0ebf487eceaac2d88 100644 (file)
@@ -441,7 +441,6 @@ static int au1550nd_probe(struct platform_device *pdev)
 
        this = &ctx->chip;
        mtd = nand_to_mtd(this);
-       mtd->priv = this;
        mtd->dev.parent = &pdev->dev;
 
        /* figure out which CS# r->start belongs to */
index 2c9bffb614c5b9808a34c9f80f77b01c3f44952c..b44f821b1a3a9895818f2b056082f06a47860c2b 100644 (file)
@@ -37,7 +37,6 @@ static int bcm47xxnflash_probe(struct platform_device *pdev)
        b47n->nand_chip.priv = b47n;
        mtd = nand_to_mtd(&b47n->nand_chip);
        mtd->dev.parent = &pdev->dev;
-       mtd->priv = &b47n->nand_chip; /* Required */
        b47n->cc = container_of(nflash, struct bcma_drv_cc, nflash);
 
        if (b47n->cc->core->bus->chipinfo.id == BCMA_CHIP_ID_BCM4706) {
index 928d5992056933d5e89e09f200df4918a13a6339..9514e136542ff5eaae25b17df3f13d5b73e02014 100644 (file)
@@ -782,7 +782,6 @@ static int bf5xx_nand_probe(struct platform_device *pdev)
        chip->chip_delay   = 0;
 
        /* initialise mtd info data struct */
-       mtd->priv       = chip;
        mtd->dev.parent = &pdev->dev;
 
        /* initialise the hardware */
index c05723b4d7734e49acd00d4de901932bbedb7647..aea08816d3ac9bf6c2fb203a993cce95b5aae1f5 100644 (file)
@@ -1924,7 +1924,6 @@ static int brcmnand_init_cs(struct brcmnand_host *host, struct device_node *dn)
 
        nand_set_flash_node(chip, dn);
        chip->priv = host;
-       mtd->priv = chip;
        mtd->name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "brcmnand.%d",
                                   host->cs);
        mtd->owner = THIS_MODULE;
index 7d6a14218bef8bf25983553a0e1d843a7d7fd919..00c15e22d82771590540ae505155f70d8671b2b2 100644 (file)
@@ -611,7 +611,6 @@ static int cafe_nand_probe(struct pci_dev *pdev,
 
        mtd = nand_to_mtd(&cafe->nand);
        mtd->dev.parent = &pdev->dev;
-       mtd->priv = &cafe->nand;
        cafe->nand.priv = cafe;
 
        cafe->pdev = pdev;
index 00fd0e933ffb9cd72a16078eedefc5ba476dc3ed..6f97ebba52c4c1136bebf752a20578aaa8ecca0a 100644 (file)
@@ -177,7 +177,6 @@ static int __init cmx270_init(void)
 
        /* Link the private data with the MTD structure */
        cmx270_nand_mtd->owner = THIS_MODULE;
-       cmx270_nand_mtd->priv = this;
 
        /* insert callbacks */
        this->IO_ADDR_R = cmx270_nand_io;
index 386ae832e03f9214b33f62edd6e9007918710e27..a65e4e0f57a1c87b7eee27ea98992ed8ff0a5c57 100644 (file)
@@ -206,7 +206,6 @@ static int __init cs553x_init_one(int cs, int mmio, unsigned long adr)
        new_mtd = nand_to_mtd(this);
 
        /* Link the private data with the MTD structure */
-       new_mtd->priv = this;
        new_mtd->owner = THIS_MODULE;
 
        /* map physical address */
index b1f69f9820703723e9796eaa088b782293f5a841..3b49fe86625d2e02acbb0974ea7ddc9b4041e13d 100644 (file)
@@ -685,7 +685,6 @@ static int nand_davinci_probe(struct platform_device *pdev)
        info->vaddr             = vaddr;
 
        mtd                     = nand_to_mtd(&info->chip);
-       mtd->priv               = &info->chip;
        mtd->dev.parent         = &pdev->dev;
        nand_set_flash_node(&info->chip, pdev->dev.of_node);
 
index b1dd172ef565374b5ffa7ec5b6da3452e15a22a8..30bf5f690f787aefa13a2260a9cd3c303f362781 100644 (file)
@@ -1470,7 +1470,6 @@ int denali_init(struct denali_nand_info *denali)
        /* now that our ISR is registered, we can enable interrupts */
        denali_set_intr_modes(denali, true);
        mtd->name = "denali-nand";
-       mtd->priv = &denali->nand;
 
        /* register the driver with the NAND core subsystem */
        denali->nand.select_chip = denali_select_chip;
index fff7a4a69759900dbd22c67f6b480568dfb0d2c8..a5c046654233cb8ac9a9e1fc27dbb9b630a73d65 100644 (file)
@@ -1569,7 +1569,6 @@ static int __init doc_probe(unsigned long physadr)
        nand->bbt_td            = (struct nand_bbt_descr *) (doc + 1);
        nand->bbt_md            = nand->bbt_td + 1;
 
-       mtd->priv               = nand;
        mtd->owner              = THIS_MODULE;
 
        nand->priv              = doc;
index 24d478d90dcc046fb4e9cc1aaddb81d9025ad9e3..95cd139e8a40772074366309243425e0e08f971b 100644 (file)
@@ -1314,7 +1314,6 @@ static int __init probe_docg4(struct platform_device *pdev)
 
        mtd = nand_to_mtd(nand);
        doc = (struct docg4_priv *) (nand + 1);
-       mtd->priv = nand;
        nand->priv = doc;
        mtd->dev.parent = &pdev->dev;
        doc->virtadr = virtadr;
index 7bde76a02555b62da29f5486c5674bb80ae494a7..e96d5bcc292211af9d1c5152a978b72de07825c3 100644 (file)
@@ -746,7 +746,6 @@ static int fsl_elbc_chip_init(struct fsl_elbc_mtd *priv)
        dev_dbg(priv->dev, "eLBC Set Information for bank %d\n", priv->bank);
 
        /* Fill in fsl_elbc_mtd structure */
-       mtd->priv = chip;
        mtd->dev.parent = priv->dev;
        nand_set_flash_node(chip, priv->dev->of_node);
 
index 3f5654f52cee9ee5677eb0030f3dbb84e3e22b7c..9d2b4ed06c81e66ece5a66dbd604e65adbac32de 100644 (file)
@@ -881,7 +881,6 @@ static int fsl_ifc_chip_init(struct fsl_ifc_mtd *priv)
        u32 csor;
 
        /* Fill in fsl_ifc_mtd structure */
-       mtd->priv = chip;
        mtd->dev.parent = priv->dev;
        nand_set_flash_node(chip, priv->dev->of_node);
 
index 0379adc2d90e74746405d72e2e3af992367673f7..cafd12de72766f193ce409d46ac5ae9b3e9489a9 100644 (file)
@@ -176,7 +176,6 @@ static int fun_chip_init(struct fsl_upm_nand *fun,
        if (fun->rnb_gpio[0] >= 0)
                fun->chip.dev_ready = fun_chip_ready;
 
-       mtd->priv = &fun->chip;
        mtd->dev.parent = fun->dev;
 
        flash_np = of_get_next_child(upm_np, NULL);
index 4c68e7a39b50b2c9ad90494be8ec9a1521326a03..9a7c1f5ffcaafc3f009ee37e2bceedde2aa475ec 100644 (file)
@@ -1009,7 +1009,6 @@ static int __init fsmc_nand_probe(struct platform_device *pdev)
        /* Link all private pointers */
        mtd = nand_to_mtd(&host->nand);
        nand = &host->nand;
-       mtd->priv = nand;
        nand->priv = host;
        nand_set_flash_node(nand, np);
 
index 99dd74c1103835e8914672106a9cb41248b90f7d..ded658fc7d73d07265e0c21abf7599e22bef89f1 100644 (file)
@@ -278,7 +278,6 @@ static int gpio_nand_probe(struct platform_device *pdev)
        chip->cmd_ctrl          = gpio_nand_cmd_ctrl;
 
        mtd                     = nand_to_mtd(chip);
-       mtd->priv               = chip;
        mtd->dev.parent         = &pdev->dev;
 
        platform_set_drvdata(pdev, gpiomtd);
index 38b07c7aa1e44fb565926ad88f2fd7a16b325561..df61f49d37709e600441ce854a051acbacfb0375 100644 (file)
@@ -1893,7 +1893,6 @@ static int gpmi_nand_init(struct gpmi_nand_data *this)
        this->current_chip      = -1;
 
        /* init the MTD data structures */
-       mtd->priv               = chip;
        mtd->name               = "gpmi-nand";
        mtd->dev.parent         = this->dev;
 
index 6e6e482c02a3853eb239d98e4749fb3945b8d420..2aee212b6169c607ffa9dcd4cba77f083dbff14e 100644 (file)
@@ -735,7 +735,6 @@ static int hisi_nfc_probe(struct platform_device *pdev)
                goto err_res;
        }
 
-       mtd->priv               = chip;
        mtd->name               = "hisi_nand";
        mtd->dev.parent         = &pdev->dev;
 
index 03239a5a04cd6377aba00772c2769cdad856f26c..a2363d33cecc56f5aedd1633b3342ad92dbde21e 100644 (file)
@@ -433,7 +433,6 @@ static int jz_nand_probe(struct platform_device *pdev)
 
        chip            = &nand->chip;
        mtd             = nand_to_mtd(chip);
-       mtd->priv       = chip;
        mtd->dev.parent = &pdev->dev;
        mtd->name       = "jz4740-nand";
 
index 3400b3f99d30ed7d0147cf20a41d170855979b0f..db59fa28d5c86aa76474f62a06eb918a07cbe159 100644 (file)
@@ -681,7 +681,6 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
 
        nand_chip->priv = host;         /* link the private data structures */
        nand_set_flash_node(nand_chip, pdev->dev.of_node);
-       mtd->priv = nand_chip;
        mtd->dev.parent = &pdev->dev;
 
        /* Get NAND clock */
index 61b2961297df4d3b717b13193787e47910d22995..ccd10b182a220db17f9f1032ad775e8edbe8e17f 100644 (file)
@@ -802,7 +802,6 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
        mtd = nand_to_mtd(chip);
        chip->priv = host;
        nand_set_flash_node(chip, pdev->dev.of_node);
-       mtd->priv = chip;
        mtd->owner = THIS_MODULE;
        mtd->dev.parent = &pdev->dev;
 
index 8b4cd82f019e02b00b70474d8633faaa710c80d2..6d0ca33dd7abc5a4e72b0b5091eca0424103f3dd 100644 (file)
@@ -656,7 +656,6 @@ static int mpc5121_nfc_probe(struct platform_device *op)
        chip = &prv->chip;
        mtd = nand_to_mtd(chip);
 
-       mtd->priv = chip;
        mtd->dev.parent = dev;
        chip->priv = prv;
        nand_set_flash_node(chip, dn);
index 9dd71af363c3602f4d5b2415622b06660a274ba0..95400992c3e9e30d7d6e6c69bac88e893d113312 100644 (file)
@@ -1514,7 +1514,6 @@ static int mxcnd_probe(struct platform_device *pdev)
        /* structures must be linked */
        this = &host->nand;
        mtd = nand_to_mtd(this);
-       mtd->priv = this;
        mtd->dev.parent = &pdev->dev;
        mtd->name = DRIVER_NAME;
 
index 442eeaf09ebae3800d989f23aa2f0f96eff85684..78de37ddf88b0610b6755de3dd505b60381e62e0 100644 (file)
@@ -2243,7 +2243,6 @@ static int __init ns_init_module(void)
                return -ENOMEM;
        }
        nsmtd       = nand_to_mtd(chip);
-        nsmtd->priv = (void *)chip;
        nand        = (struct nandsim *)(chip + 1);
        chip->priv  = (void *)nand;
 
index 3a7168e5200723c8d769b3e77218456385612b56..0709ea9dd8ede619270a1653e976114cd39a2861 100644 (file)
@@ -167,7 +167,6 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc,
        chip->ecc.strength = 1;
        chip->priv = ndfc;
 
-       mtd->priv = chip;
        mtd->dev.parent = &ndfc->ofdev->dev;
 
        flash_np = of_get_next_child(node, NULL);
index 4dad170f6545fe4a4ca4a7b1f80a01e5291b2053..220ddfcf29f52535cd077f99ab5821a572962412 100644 (file)
@@ -245,7 +245,6 @@ static int nuc900_nand_probe(struct platform_device *pdev)
        chip = &(nuc900_nand->chip);
        mtd = nand_to_mtd(chip);
 
-       mtd->priv               = chip;
        mtd->dev.parent         = &pdev->dev;
        spin_lock_init(&nuc900_nand->lock);
 
index f9d0b58323e3885c7ad2a23f1f14ffe3191a89be..e9cbbc63c566fdcad99e9303bcc1aa68edfdbc45 100644 (file)
@@ -1672,7 +1672,6 @@ static int omap_nand_probe(struct platform_device *pdev)
        info->ecc_opt           = pdata->ecc_opt;
        nand_chip               = &info->nand;
        mtd                     = nand_to_mtd(nand_chip);
-       mtd->priv               = &info->nand;
        mtd->dev.parent         = &pdev->dev;
        nand_chip->ecc.priv     = NULL;
        nand_set_flash_node(nand_chip, pdata->of_node);
index 087a04024d6a0e23cb54aa0b1343e772805ceb9c..2c2be612448e7e6c423eb93346489ccb3a054cbd 100644 (file)
@@ -122,7 +122,6 @@ static int __init orion_nand_probe(struct platform_device *pdev)
                board = dev_get_platdata(&pdev->dev);
        }
 
-       mtd->priv = nc;
        mtd->dev.parent = &pdev->dev;
 
        nc->priv = board;
index 4dd298523e815c4548a81196cfc3326e2347cc35..3ab53ca53cca231c2e3431cc20f3d1932000601f 100644 (file)
@@ -121,7 +121,6 @@ static int pasemi_nand_probe(struct platform_device *ofdev)
        pasemi_nand_mtd = nand_to_mtd(chip);
 
        /* Link the private data with the MTD structure */
-       pasemi_nand_mtd->priv = chip;
        pasemi_nand_mtd->dev.parent = &ofdev->dev;
 
        chip->IO_ADDR_R = of_iomap(np, 0);
index 796eb7d54f2f191d66ca9d28a7c47753b2ff26ae..dc88a58d5cdeb3d9471479102575b44fdacc6044 100644 (file)
@@ -59,7 +59,6 @@ static int plat_nand_probe(struct platform_device *pdev)
        data->chip.priv = &data;
        nand_set_flash_node(&data->chip, pdev->dev.of_node);
        mtd = nand_to_mtd(&data->chip);
-       mtd->priv = &data->chip;
        mtd->dev.parent = &pdev->dev;
 
        data->chip.IO_ADDR_R = data->io_base;
index c4d578809ea97a88c56a4a489cd96af0606bc5d9..10704ae129fc2548ccbdf8b33f1f044feb5e1b13 100644 (file)
@@ -1709,7 +1709,6 @@ static int alloc_nand_resource(struct platform_device *pdev)
                info->host[cs] = host;
                host->cs = cs;
                host->info_data = info;
-               mtd->priv = chip;
                mtd->dev.parent = &pdev->dev;
                /* FIXME: all chips use the same device tree partitions */
                nand_set_flash_node(chip, np);
index 1ac8ef2ed2dbc25a030e051f8fbbc0f836b1c305..cb0bf09214d5cd29e6077917b2901c16e69b9de8 100644 (file)
@@ -638,7 +638,6 @@ static int r852_register_nand_device(struct r852_device *dev)
 
        WARN_ON(dev->card_registred);
 
-       mtd->priv = dev->chip;
        mtd->dev.parent = &dev->pci_dev->dev;
 
        if (dev->readonly)
index c074a491d087ff596dafd11899fe62635c3f4868..bc94c5db01bf13564d88674b77273cb77022c9f1 100644 (file)
@@ -788,7 +788,6 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
                                   struct s3c2410_nand_set *set)
 {
        struct nand_chip *chip = &nmtd->chip;
-       struct mtd_info *mtd = nand_to_mtd(chip);
        void __iomem *regs = info->regs;
 
        chip->write_buf    = s3c2410_nand_write_buf;
@@ -834,7 +833,6 @@ static void s3c2410_nand_init_chip(struct s3c2410_nand_info *info,
        chip->IO_ADDR_R = chip->IO_ADDR_W;
 
        nmtd->info         = info;
-       mtd->priv          = chip;
        nmtd->set          = set;
 
 #ifdef CONFIG_MTD_NAND_S3C2410_HWECC
index 0ec4b04b35362415e1713ec5c6f605dc652c2e87..c7126b75fb0149d7c134b80f0a2f74890698df8e 100644 (file)
@@ -1123,7 +1123,6 @@ static int flctl_probe(struct platform_device *pdev)
        nand = &flctl->chip;
        flctl_mtd = nand_to_mtd(nand);
        nand_set_flash_node(nand, pdev->dev.of_node);
-       flctl_mtd->priv = nand;
        flctl_mtd->dev.parent = &pdev->dev;
        flctl->pdev = pdev;
        flctl->hwecc = pdata->has_hwecc;
index 4b649fbad66ec085122cb2d84d4d00b2edc2e14e..b7d1b55a160b4ebbbbc0fb52d80d8ee99da6612d 100644 (file)
@@ -147,7 +147,6 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
 
        /* Link the private data with the MTD structure */
        mtd = nand_to_mtd(this);
-       mtd->priv = this;
        mtd->dev.parent = &pdev->dev;
 
        platform_set_drvdata(pdev, sharpsl);
index 925761c240ca6313d3cae61920902a423d388e4a..d7e9d4df8c2826ae2a197ee7d044cd2dbac3bcd6 100644 (file)
@@ -164,7 +164,6 @@ static int socrates_nand_probe(struct platform_device *ofdev)
 
        nand_chip->priv = host;         /* link the private data structures */
        nand_set_flash_node(nand_chip, ofdev->dev.of_node);
-       mtd->priv = nand_chip;
        mtd->name = "socrates_nand";
        mtd->dev.parent = &ofdev->dev;
 
index c29d659a747a4731fde6097803d03b22aae048c3..51e10a35fe08c29d6a27ef94563b4a8036f7e41a 100644 (file)
@@ -1337,7 +1337,6 @@ static int sunxi_nand_chip_init(struct device *dev, struct sunxi_nfc *nfc,
 
        mtd = nand_to_mtd(nand);
        mtd->dev.parent = dev;
-       mtd->priv = nand;
 
        ret = nand_scan_ident(mtd, nsels, NULL);
        if (ret)
index e7b82e11c79581903fbd95355f2dabb2ed649be0..08b30549ec0a0e61f3cd236102f77f6ad9e16097 100644 (file)
@@ -382,7 +382,6 @@ static int tmio_probe(struct platform_device *dev)
        platform_set_drvdata(dev, tmio);
        nand_chip = &tmio->chip;
        mtd = nand_to_mtd(nand_chip);
-       mtd->priv = nand_chip;
        mtd->name = "tmio-nand";
        mtd->dev.parent = &dev->dev;
 
index da7fcbd37f3a10cbdfa194cac5d21a11a1444fcd..27488ee4438643e90eaf9c2f6f41dbb326c992c7 100644 (file)
@@ -324,8 +324,6 @@ static int __init txx9ndfmc_probe(struct platform_device *dev)
                mtd = nand_to_mtd(chip);
                mtd->dev.parent = &dev->dev;
 
-               mtd->priv = chip;
-
                chip->read_byte = txx9ndfmc_read_byte;
                chip->read_buf = txx9ndfmc_read_buf;
                chip->write_buf = txx9ndfmc_write_buf;
index 1bbb93a7b4e5fb1b24aaf09ffb6da02272910417..034420f313d500634e4ad66e46129535fac619d7 100644 (file)
@@ -679,7 +679,6 @@ static int vf610_nfc_probe(struct platform_device *pdev)
        chip = &nfc->chip;
        mtd = nand_to_mtd(chip);
 
-       mtd->priv = chip;
        mtd->owner = THIS_MODULE;
        mtd->dev.parent = nfc->dev;
        mtd->name = DRV_NAME;