Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mtd: nand: use dev_get_platdata()

Use the wrapper function for retrieving the platform data instead of
accessing dev->platform_data directly.

Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>

authored by

Jingoo Han and committed by
David Woodhouse
453810b7 d20d5a57

+37 -35
+1 -1
drivers/mtd/nand/atmel_nand.c
··· 2023 2023 if (res) 2024 2024 goto err_nand_ioremap; 2025 2025 } else { 2026 - memcpy(&host->board, pdev->dev.platform_data, 2026 + memcpy(&host->board, dev_get_platdata(&pdev->dev), 2027 2027 sizeof(struct atmel_nand_data)); 2028 2028 } 2029 2029
+1 -1
drivers/mtd/nand/au1550nd.c
··· 411 411 struct resource *r; 412 412 int ret, cs; 413 413 414 - pd = pdev->dev.platform_data; 414 + pd = dev_get_platdata(&pdev->dev); 415 415 if (!pd) { 416 416 dev_err(&pdev->dev, "missing platform data\n"); 417 417 return -ENODEV;
+1 -1
drivers/mtd/nand/bf5xx_nand.c
··· 171 171 172 172 static struct bf5xx_nand_platform *to_nand_plat(struct platform_device *pdev) 173 173 { 174 - return pdev->dev.platform_data; 174 + return dev_get_platdata(&pdev->dev); 175 175 } 176 176 177 177 /*
+3 -3
drivers/mtd/nand/davinci_nand.c
··· 530 530 static struct davinci_nand_pdata 531 531 *nand_davinci_get_pdata(struct platform_device *pdev) 532 532 { 533 - if (!pdev->dev.platform_data && pdev->dev.of_node) { 533 + if (!dev_get_platdata(&pdev->dev) && pdev->dev.of_node) { 534 534 struct davinci_nand_pdata *pdata; 535 535 const char *mode; 536 536 u32 prop; ··· 575 575 pdata->bbt_options = NAND_BBT_USE_FLASH; 576 576 } 577 577 578 - return pdev->dev.platform_data; 578 + return dev_get_platdata(&pdev->dev); 579 579 } 580 580 #else 581 581 static struct davinci_nand_pdata 582 582 *nand_davinci_get_pdata(struct platform_device *pdev) 583 583 { 584 - return pdev->dev.platform_data; 584 + return dev_get_platdata(&pdev->dev); 585 585 } 586 586 #endif 587 587
+3 -3
drivers/mtd/nand/gpio.c
··· 167 167 if (!ret) 168 168 return ret; 169 169 170 - if (dev->platform_data) { 171 - memcpy(plat, dev->platform_data, sizeof(*plat)); 170 + if (dev_get_platdata(dev)) { 171 + memcpy(plat, dev_get_platdata(dev), sizeof(*plat)); 172 172 return 0; 173 173 } 174 174 ··· 207 207 struct mtd_part_parser_data ppdata = {}; 208 208 int ret = 0; 209 209 210 - if (!pdev->dev.of_node && !pdev->dev.platform_data) 210 + if (!pdev->dev.of_node && !dev_get_platdata(&pdev->dev)) 211 211 return -EINVAL; 212 212 213 213 gpiomtd = devm_kzalloc(&pdev->dev, sizeof(*gpiomtd), GFP_KERNEL);
+2 -2
drivers/mtd/nand/jz4740_nand.c
··· 411 411 struct jz_nand *nand; 412 412 struct nand_chip *chip; 413 413 struct mtd_info *mtd; 414 - struct jz_nand_platform_data *pdata = pdev->dev.platform_data; 414 + struct jz_nand_platform_data *pdata = dev_get_platdata(&pdev->dev); 415 415 size_t chipnr, bank_idx; 416 416 uint8_t nand_maf_id = 0, nand_dev_id = 0; 417 417 ··· 548 548 static int jz_nand_remove(struct platform_device *pdev) 549 549 { 550 550 struct jz_nand *nand = platform_get_drvdata(pdev); 551 - struct jz_nand_platform_data *pdata = pdev->dev.platform_data; 551 + struct jz_nand_platform_data *pdata = dev_get_platdata(&pdev->dev); 552 552 size_t i; 553 553 554 554 nand_release(&nand->mtd);
+1 -1
drivers/mtd/nand/lpc32xx_mlc.c
··· 696 696 } 697 697 lpc32xx_wp_disable(host); 698 698 699 - host->pdata = pdev->dev.platform_data; 699 + host->pdata = dev_get_platdata(&pdev->dev); 700 700 701 701 nand_chip->priv = host; /* link the private data structures */ 702 702 mtd->priv = nand_chip;
+1 -1
drivers/mtd/nand/lpc32xx_slc.c
··· 798 798 } 799 799 lpc32xx_wp_disable(host); 800 800 801 - host->pdata = pdev->dev.platform_data; 801 + host->pdata = dev_get_platdata(&pdev->dev); 802 802 803 803 mtd = &host->mtd; 804 804 chip = &host->nand_chip;
+2 -1
drivers/mtd/nand/mxc_nand.c
··· 1432 1432 1433 1433 err = mxcnd_probe_dt(host); 1434 1434 if (err > 0) { 1435 - struct mxc_nand_platform_data *pdata = pdev->dev.platform_data; 1435 + struct mxc_nand_platform_data *pdata = 1436 + dev_get_platdata(&pdev->dev); 1436 1437 if (pdata) { 1437 1438 host->pdata = *pdata; 1438 1439 host->devtype_data = (struct mxc_nand_devtype_data *)
+1 -1
drivers/mtd/nand/omap2.c
··· 1831 1831 struct resource *res; 1832 1832 struct mtd_part_parser_data ppdata = {}; 1833 1833 1834 - pdata = pdev->dev.platform_data; 1834 + pdata = dev_get_platdata(&pdev->dev); 1835 1835 if (pdata == NULL) { 1836 1836 dev_err(&pdev->dev, "platform data missing\n"); 1837 1837 return -ENODEV;
+3 -2
drivers/mtd/nand/orion_nand.c
··· 130 130 if (!of_property_read_u32(pdev->dev.of_node, 131 131 "chip-delay", &val)) 132 132 board->chip_delay = (u8)val; 133 - } else 134 - board = pdev->dev.platform_data; 133 + } else { 134 + board = dev_get_platdata(&pdev->dev); 135 + } 135 136 136 137 mtd->priv = nc; 137 138 mtd->owner = THIS_MODULE;
+2 -2
drivers/mtd/nand/plat_nand.c
··· 30 30 */ 31 31 static int plat_nand_probe(struct platform_device *pdev) 32 32 { 33 - struct platform_nand_data *pdata = pdev->dev.platform_data; 33 + struct platform_nand_data *pdata = dev_get_platdata(&pdev->dev); 34 34 struct mtd_part_parser_data ppdata; 35 35 struct plat_nand_data *data; 36 36 struct resource *res; ··· 136 136 static int plat_nand_remove(struct platform_device *pdev) 137 137 { 138 138 struct plat_nand_data *data = platform_get_drvdata(pdev); 139 - struct platform_nand_data *pdata = pdev->dev.platform_data; 139 + struct platform_nand_data *pdata = dev_get_platdata(&pdev->dev); 140 140 struct resource *res; 141 141 142 142 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+7 -7
drivers/mtd/nand/pxa3xx_nand.c
··· 815 815 const struct pxa3xx_nand_flash *f) 816 816 { 817 817 struct platform_device *pdev = info->pdev; 818 - struct pxa3xx_nand_platform_data *pdata = pdev->dev.platform_data; 818 + struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev); 819 819 struct pxa3xx_nand_host *host = info->host[info->cs]; 820 820 uint32_t ndcr = 0x0; /* enable all interrupts */ 821 821 ··· 958 958 struct pxa3xx_nand_host *host = mtd->priv; 959 959 struct pxa3xx_nand_info *info = host->info_data; 960 960 struct platform_device *pdev = info->pdev; 961 - struct pxa3xx_nand_platform_data *pdata = pdev->dev.platform_data; 961 + struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev); 962 962 struct nand_flash_dev pxa3xx_flash_ids[2], *def = NULL; 963 963 const struct pxa3xx_nand_flash *f = NULL; 964 964 struct nand_chip *chip = mtd->priv; ··· 1058 1058 struct resource *r; 1059 1059 int ret, irq, cs; 1060 1060 1061 - pdata = pdev->dev.platform_data; 1061 + pdata = dev_get_platdata(&pdev->dev); 1062 1062 info = devm_kzalloc(&pdev->dev, sizeof(*info) + (sizeof(*mtd) + 1063 1063 sizeof(*host)) * pdata->num_cs, GFP_KERNEL); 1064 1064 if (!info) ··· 1176 1176 if (!info) 1177 1177 return 0; 1178 1178 1179 - pdata = pdev->dev.platform_data; 1179 + pdata = dev_get_platdata(&pdev->dev); 1180 1180 1181 1181 irq = platform_get_irq(pdev, 0); 1182 1182 if (irq >= 0) ··· 1239 1239 if (ret) 1240 1240 return ret; 1241 1241 1242 - pdata = pdev->dev.platform_data; 1242 + pdata = dev_get_platdata(&pdev->dev); 1243 1243 if (!pdata) { 1244 1244 dev_err(&pdev->dev, "no platform data defined\n"); 1245 1245 return -ENODEV; ··· 1286 1286 struct mtd_info *mtd; 1287 1287 int cs; 1288 1288 1289 - pdata = pdev->dev.platform_data; 1289 + pdata = dev_get_platdata(&pdev->dev); 1290 1290 if (info->state) { 1291 1291 dev_err(&pdev->dev, "driver busy, state = %d\n", info->state); 1292 1292 return -EAGAIN; ··· 1307 1307 struct mtd_info *mtd; 1308 1308 int cs; 1309 1309 1310 - pdata = pdev->dev.platform_data; 1310 + pdata = dev_get_platdata(&pdev->dev); 1311 1311 /* We don't want to handle interrupt without calling mtd routine */ 1312 1312 disable_int(info, NDCR_INT_MASK); 1313 1313
+1 -1
drivers/mtd/nand/s3c2410.c
··· 150 150 151 151 static struct s3c2410_platform_nand *to_nand_plat(struct platform_device *dev) 152 152 { 153 - return dev->dev.platform_data; 153 + return dev_get_platdata(&dev->dev); 154 154 } 155 155 156 156 static inline int allow_clk_suspend(struct s3c2410_nand_info *info)
+2 -2
drivers/mtd/nand/sh_flctl.c
··· 137 137 dma_cap_mask_t mask; 138 138 struct dma_slave_config cfg; 139 139 struct platform_device *pdev = flctl->pdev; 140 - struct sh_flctl_platform_data *pdata = pdev->dev.platform_data; 140 + struct sh_flctl_platform_data *pdata = dev_get_platdata(&pdev->dev); 141 141 int ret; 142 142 143 143 if (!pdata) ··· 1131 1131 if (pdev->dev.of_node) 1132 1132 pdata = flctl_parse_dt(&pdev->dev); 1133 1133 else 1134 - pdata = pdev->dev.platform_data; 1134 + pdata = dev_get_platdata(&pdev->dev); 1135 1135 1136 1136 if (!pdata) { 1137 1137 dev_err(&pdev->dev, "no setup data defined\n");
+1 -1
drivers/mtd/nand/sharpsl.c
··· 112 112 struct resource *r; 113 113 int err = 0; 114 114 struct sharpsl_nand *sharpsl; 115 - struct sharpsl_nand_platform_data *data = pdev->dev.platform_data; 115 + struct sharpsl_nand_platform_data *data = dev_get_platdata(&pdev->dev); 116 116 117 117 if (!data) { 118 118 dev_err(&pdev->dev, "no platform data!\n");
+1 -1
drivers/mtd/nand/tmio_nand.c
··· 357 357 358 358 static int tmio_probe(struct platform_device *dev) 359 359 { 360 - struct tmio_nand_data *data = dev->dev.platform_data; 360 + struct tmio_nand_data *data = dev_get_platdata(&dev->dev); 361 361 struct resource *fcr = platform_get_resource(dev, 362 362 IORESOURCE_MEM, 0); 363 363 struct resource *ccr = platform_get_resource(dev,
+4 -4
drivers/mtd/nand/txx9ndfmc.c
··· 87 87 static void __iomem *ndregaddr(struct platform_device *dev, unsigned int reg) 88 88 { 89 89 struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); 90 - struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; 90 + struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); 91 91 92 92 return drvdata->base + (reg << plat->shift); 93 93 } ··· 138 138 struct nand_chip *chip = mtd->priv; 139 139 struct txx9ndfmc_priv *txx9_priv = chip->priv; 140 140 struct platform_device *dev = txx9_priv->dev; 141 - struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; 141 + struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); 142 142 143 143 if (ctrl & NAND_CTRL_CHANGE) { 144 144 u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); ··· 225 225 226 226 static void txx9ndfmc_initialize(struct platform_device *dev) 227 227 { 228 - struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; 228 + struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); 229 229 struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); 230 230 int tmout = 100; 231 231 ··· 274 274 275 275 static int __init txx9ndfmc_probe(struct platform_device *dev) 276 276 { 277 - struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; 277 + struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev); 278 278 int hold, spw; 279 279 int i; 280 280 struct txx9ndfmc_drvdata *drvdata;