mirror of https://gitee.com/openkylin/linux.git
mtd: nand: remove useless mtd->priv = chip assignments
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>
This commit is contained in:
parent
2d3b77bac3
commit
37f5a54646
|
@ -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
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue