Commit 453810b7 authored by Jingoo Han's avatar Jingoo Han Committed by David Woodhouse

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: default avatarJingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent d20d5a57
...@@ -2023,7 +2023,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev) ...@@ -2023,7 +2023,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
if (res) if (res)
goto err_nand_ioremap; goto err_nand_ioremap;
} else { } else {
memcpy(&host->board, pdev->dev.platform_data, memcpy(&host->board, dev_get_platdata(&pdev->dev),
sizeof(struct atmel_nand_data)); sizeof(struct atmel_nand_data));
} }
......
...@@ -411,7 +411,7 @@ static int au1550nd_probe(struct platform_device *pdev) ...@@ -411,7 +411,7 @@ static int au1550nd_probe(struct platform_device *pdev)
struct resource *r; struct resource *r;
int ret, cs; int ret, cs;
pd = pdev->dev.platform_data; pd = dev_get_platdata(&pdev->dev);
if (!pd) { if (!pd) {
dev_err(&pdev->dev, "missing platform data\n"); dev_err(&pdev->dev, "missing platform data\n");
return -ENODEV; return -ENODEV;
......
...@@ -171,7 +171,7 @@ static struct bf5xx_nand_info *to_nand_info(struct platform_device *pdev) ...@@ -171,7 +171,7 @@ static struct bf5xx_nand_info *to_nand_info(struct platform_device *pdev)
static struct bf5xx_nand_platform *to_nand_plat(struct platform_device *pdev) static struct bf5xx_nand_platform *to_nand_plat(struct platform_device *pdev)
{ {
return pdev->dev.platform_data; return dev_get_platdata(&pdev->dev);
} }
/* /*
......
...@@ -530,7 +530,7 @@ MODULE_DEVICE_TABLE(of, davinci_nand_of_match); ...@@ -530,7 +530,7 @@ MODULE_DEVICE_TABLE(of, davinci_nand_of_match);
static struct davinci_nand_pdata static struct davinci_nand_pdata
*nand_davinci_get_pdata(struct platform_device *pdev) *nand_davinci_get_pdata(struct platform_device *pdev)
{ {
if (!pdev->dev.platform_data && pdev->dev.of_node) { if (!dev_get_platdata(&pdev->dev) && pdev->dev.of_node) {
struct davinci_nand_pdata *pdata; struct davinci_nand_pdata *pdata;
const char *mode; const char *mode;
u32 prop; u32 prop;
...@@ -575,13 +575,13 @@ static struct davinci_nand_pdata ...@@ -575,13 +575,13 @@ static struct davinci_nand_pdata
pdata->bbt_options = NAND_BBT_USE_FLASH; pdata->bbt_options = NAND_BBT_USE_FLASH;
} }
return pdev->dev.platform_data; return dev_get_platdata(&pdev->dev);
} }
#else #else
static struct davinci_nand_pdata static struct davinci_nand_pdata
*nand_davinci_get_pdata(struct platform_device *pdev) *nand_davinci_get_pdata(struct platform_device *pdev)
{ {
return pdev->dev.platform_data; return dev_get_platdata(&pdev->dev);
} }
#endif #endif
......
...@@ -167,8 +167,8 @@ static inline int gpio_nand_get_config(const struct device *dev, ...@@ -167,8 +167,8 @@ static inline int gpio_nand_get_config(const struct device *dev,
if (!ret) if (!ret)
return ret; return ret;
if (dev->platform_data) { if (dev_get_platdata(dev)) {
memcpy(plat, dev->platform_data, sizeof(*plat)); memcpy(plat, dev_get_platdata(dev), sizeof(*plat));
return 0; return 0;
} }
...@@ -207,7 +207,7 @@ static int gpio_nand_probe(struct platform_device *pdev) ...@@ -207,7 +207,7 @@ static int gpio_nand_probe(struct platform_device *pdev)
struct mtd_part_parser_data ppdata = {}; struct mtd_part_parser_data ppdata = {};
int ret = 0; int ret = 0;
if (!pdev->dev.of_node && !pdev->dev.platform_data) if (!pdev->dev.of_node && !dev_get_platdata(&pdev->dev))
return -EINVAL; return -EINVAL;
gpiomtd = devm_kzalloc(&pdev->dev, sizeof(*gpiomtd), GFP_KERNEL); gpiomtd = devm_kzalloc(&pdev->dev, sizeof(*gpiomtd), GFP_KERNEL);
......
...@@ -411,7 +411,7 @@ static int jz_nand_probe(struct platform_device *pdev) ...@@ -411,7 +411,7 @@ static int jz_nand_probe(struct platform_device *pdev)
struct jz_nand *nand; struct jz_nand *nand;
struct nand_chip *chip; struct nand_chip *chip;
struct mtd_info *mtd; struct mtd_info *mtd;
struct jz_nand_platform_data *pdata = pdev->dev.platform_data; struct jz_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
size_t chipnr, bank_idx; size_t chipnr, bank_idx;
uint8_t nand_maf_id = 0, nand_dev_id = 0; uint8_t nand_maf_id = 0, nand_dev_id = 0;
...@@ -548,7 +548,7 @@ static int jz_nand_probe(struct platform_device *pdev) ...@@ -548,7 +548,7 @@ static int jz_nand_probe(struct platform_device *pdev)
static int jz_nand_remove(struct platform_device *pdev) static int jz_nand_remove(struct platform_device *pdev)
{ {
struct jz_nand *nand = platform_get_drvdata(pdev); struct jz_nand *nand = platform_get_drvdata(pdev);
struct jz_nand_platform_data *pdata = pdev->dev.platform_data; struct jz_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
size_t i; size_t i;
nand_release(&nand->mtd); nand_release(&nand->mtd);
......
...@@ -696,7 +696,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) ...@@ -696,7 +696,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
} }
lpc32xx_wp_disable(host); lpc32xx_wp_disable(host);
host->pdata = pdev->dev.platform_data; host->pdata = dev_get_platdata(&pdev->dev);
nand_chip->priv = host; /* link the private data structures */ nand_chip->priv = host; /* link the private data structures */
mtd->priv = nand_chip; mtd->priv = nand_chip;
......
...@@ -798,7 +798,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev) ...@@ -798,7 +798,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
} }
lpc32xx_wp_disable(host); lpc32xx_wp_disable(host);
host->pdata = pdev->dev.platform_data; host->pdata = dev_get_platdata(&pdev->dev);
mtd = &host->mtd; mtd = &host->mtd;
chip = &host->nand_chip; chip = &host->nand_chip;
......
...@@ -1432,7 +1432,8 @@ static int mxcnd_probe(struct platform_device *pdev) ...@@ -1432,7 +1432,8 @@ static int mxcnd_probe(struct platform_device *pdev)
err = mxcnd_probe_dt(host); err = mxcnd_probe_dt(host);
if (err > 0) { if (err > 0) {
struct mxc_nand_platform_data *pdata = pdev->dev.platform_data; struct mxc_nand_platform_data *pdata =
dev_get_platdata(&pdev->dev);
if (pdata) { if (pdata) {
host->pdata = *pdata; host->pdata = *pdata;
host->devtype_data = (struct mxc_nand_devtype_data *) host->devtype_data = (struct mxc_nand_devtype_data *)
......
...@@ -1831,7 +1831,7 @@ static int omap_nand_probe(struct platform_device *pdev) ...@@ -1831,7 +1831,7 @@ static int omap_nand_probe(struct platform_device *pdev)
struct resource *res; struct resource *res;
struct mtd_part_parser_data ppdata = {}; struct mtd_part_parser_data ppdata = {};
pdata = pdev->dev.platform_data; pdata = dev_get_platdata(&pdev->dev);
if (pdata == NULL) { if (pdata == NULL) {
dev_err(&pdev->dev, "platform data missing\n"); dev_err(&pdev->dev, "platform data missing\n");
return -ENODEV; return -ENODEV;
......
...@@ -130,8 +130,9 @@ static int __init orion_nand_probe(struct platform_device *pdev) ...@@ -130,8 +130,9 @@ static int __init orion_nand_probe(struct platform_device *pdev)
if (!of_property_read_u32(pdev->dev.of_node, if (!of_property_read_u32(pdev->dev.of_node,
"chip-delay", &val)) "chip-delay", &val))
board->chip_delay = (u8)val; board->chip_delay = (u8)val;
} else } else {
board = pdev->dev.platform_data; board = dev_get_platdata(&pdev->dev);
}
mtd->priv = nc; mtd->priv = nc;
mtd->owner = THIS_MODULE; mtd->owner = THIS_MODULE;
......
...@@ -30,7 +30,7 @@ static const char *part_probe_types[] = { "cmdlinepart", NULL }; ...@@ -30,7 +30,7 @@ static const char *part_probe_types[] = { "cmdlinepart", NULL };
*/ */
static int plat_nand_probe(struct platform_device *pdev) static int plat_nand_probe(struct platform_device *pdev)
{ {
struct platform_nand_data *pdata = pdev->dev.platform_data; struct platform_nand_data *pdata = dev_get_platdata(&pdev->dev);
struct mtd_part_parser_data ppdata; struct mtd_part_parser_data ppdata;
struct plat_nand_data *data; struct plat_nand_data *data;
struct resource *res; struct resource *res;
...@@ -136,7 +136,7 @@ static int plat_nand_probe(struct platform_device *pdev) ...@@ -136,7 +136,7 @@ static int plat_nand_probe(struct platform_device *pdev)
static int plat_nand_remove(struct platform_device *pdev) static int plat_nand_remove(struct platform_device *pdev)
{ {
struct plat_nand_data *data = platform_get_drvdata(pdev); struct plat_nand_data *data = platform_get_drvdata(pdev);
struct platform_nand_data *pdata = pdev->dev.platform_data; struct platform_nand_data *pdata = dev_get_platdata(&pdev->dev);
struct resource *res; struct resource *res;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
......
...@@ -815,7 +815,7 @@ static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info, ...@@ -815,7 +815,7 @@ static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info,
const struct pxa3xx_nand_flash *f) const struct pxa3xx_nand_flash *f)
{ {
struct platform_device *pdev = info->pdev; struct platform_device *pdev = info->pdev;
struct pxa3xx_nand_platform_data *pdata = pdev->dev.platform_data; struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct pxa3xx_nand_host *host = info->host[info->cs]; struct pxa3xx_nand_host *host = info->host[info->cs];
uint32_t ndcr = 0x0; /* enable all interrupts */ uint32_t ndcr = 0x0; /* enable all interrupts */
...@@ -958,7 +958,7 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd) ...@@ -958,7 +958,7 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd)
struct pxa3xx_nand_host *host = mtd->priv; struct pxa3xx_nand_host *host = mtd->priv;
struct pxa3xx_nand_info *info = host->info_data; struct pxa3xx_nand_info *info = host->info_data;
struct platform_device *pdev = info->pdev; struct platform_device *pdev = info->pdev;
struct pxa3xx_nand_platform_data *pdata = pdev->dev.platform_data; struct pxa3xx_nand_platform_data *pdata = dev_get_platdata(&pdev->dev);
struct nand_flash_dev pxa3xx_flash_ids[2], *def = NULL; struct nand_flash_dev pxa3xx_flash_ids[2], *def = NULL;
const struct pxa3xx_nand_flash *f = NULL; const struct pxa3xx_nand_flash *f = NULL;
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd->priv;
...@@ -1058,7 +1058,7 @@ static int alloc_nand_resource(struct platform_device *pdev) ...@@ -1058,7 +1058,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
struct resource *r; struct resource *r;
int ret, irq, cs; int ret, irq, cs;
pdata = pdev->dev.platform_data; pdata = dev_get_platdata(&pdev->dev);
info = devm_kzalloc(&pdev->dev, sizeof(*info) + (sizeof(*mtd) + info = devm_kzalloc(&pdev->dev, sizeof(*info) + (sizeof(*mtd) +
sizeof(*host)) * pdata->num_cs, GFP_KERNEL); sizeof(*host)) * pdata->num_cs, GFP_KERNEL);
if (!info) if (!info)
...@@ -1176,7 +1176,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev) ...@@ -1176,7 +1176,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
if (!info) if (!info)
return 0; return 0;
pdata = pdev->dev.platform_data; pdata = dev_get_platdata(&pdev->dev);
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq >= 0) if (irq >= 0)
...@@ -1239,7 +1239,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev) ...@@ -1239,7 +1239,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
if (ret) if (ret)
return ret; return ret;
pdata = pdev->dev.platform_data; pdata = dev_get_platdata(&pdev->dev);
if (!pdata) { if (!pdata) {
dev_err(&pdev->dev, "no platform data defined\n"); dev_err(&pdev->dev, "no platform data defined\n");
return -ENODEV; return -ENODEV;
...@@ -1286,7 +1286,7 @@ static int pxa3xx_nand_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -1286,7 +1286,7 @@ static int pxa3xx_nand_suspend(struct platform_device *pdev, pm_message_t state)
struct mtd_info *mtd; struct mtd_info *mtd;
int cs; int cs;
pdata = pdev->dev.platform_data; pdata = dev_get_platdata(&pdev->dev);
if (info->state) { if (info->state) {
dev_err(&pdev->dev, "driver busy, state = %d\n", info->state); dev_err(&pdev->dev, "driver busy, state = %d\n", info->state);
return -EAGAIN; return -EAGAIN;
...@@ -1307,7 +1307,7 @@ static int pxa3xx_nand_resume(struct platform_device *pdev) ...@@ -1307,7 +1307,7 @@ static int pxa3xx_nand_resume(struct platform_device *pdev)
struct mtd_info *mtd; struct mtd_info *mtd;
int cs; int cs;
pdata = pdev->dev.platform_data; pdata = dev_get_platdata(&pdev->dev);
/* We don't want to handle interrupt without calling mtd routine */ /* We don't want to handle interrupt without calling mtd routine */
disable_int(info, NDCR_INT_MASK); disable_int(info, NDCR_INT_MASK);
......
...@@ -150,7 +150,7 @@ static struct s3c2410_nand_info *to_nand_info(struct platform_device *dev) ...@@ -150,7 +150,7 @@ static struct s3c2410_nand_info *to_nand_info(struct platform_device *dev)
static struct s3c2410_platform_nand *to_nand_plat(struct platform_device *dev) static struct s3c2410_platform_nand *to_nand_plat(struct platform_device *dev)
{ {
return dev->dev.platform_data; return dev_get_platdata(&dev->dev);
} }
static inline int allow_clk_suspend(struct s3c2410_nand_info *info) static inline int allow_clk_suspend(struct s3c2410_nand_info *info)
......
...@@ -137,7 +137,7 @@ static void flctl_setup_dma(struct sh_flctl *flctl) ...@@ -137,7 +137,7 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
dma_cap_mask_t mask; dma_cap_mask_t mask;
struct dma_slave_config cfg; struct dma_slave_config cfg;
struct platform_device *pdev = flctl->pdev; struct platform_device *pdev = flctl->pdev;
struct sh_flctl_platform_data *pdata = pdev->dev.platform_data; struct sh_flctl_platform_data *pdata = dev_get_platdata(&pdev->dev);
int ret; int ret;
if (!pdata) if (!pdata)
...@@ -1131,7 +1131,7 @@ static int flctl_probe(struct platform_device *pdev) ...@@ -1131,7 +1131,7 @@ static int flctl_probe(struct platform_device *pdev)
if (pdev->dev.of_node) if (pdev->dev.of_node)
pdata = flctl_parse_dt(&pdev->dev); pdata = flctl_parse_dt(&pdev->dev);
else else
pdata = pdev->dev.platform_data; pdata = dev_get_platdata(&pdev->dev);
if (!pdata) { if (!pdata) {
dev_err(&pdev->dev, "no setup data defined\n"); dev_err(&pdev->dev, "no setup data defined\n");
......
...@@ -112,7 +112,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev) ...@@ -112,7 +112,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
struct resource *r; struct resource *r;
int err = 0; int err = 0;
struct sharpsl_nand *sharpsl; struct sharpsl_nand *sharpsl;
struct sharpsl_nand_platform_data *data = pdev->dev.platform_data; struct sharpsl_nand_platform_data *data = dev_get_platdata(&pdev->dev);
if (!data) { if (!data) {
dev_err(&pdev->dev, "no platform data!\n"); dev_err(&pdev->dev, "no platform data!\n");
......
...@@ -357,7 +357,7 @@ static void tmio_hw_stop(struct platform_device *dev, struct tmio_nand *tmio) ...@@ -357,7 +357,7 @@ static void tmio_hw_stop(struct platform_device *dev, struct tmio_nand *tmio)
static int tmio_probe(struct platform_device *dev) static int tmio_probe(struct platform_device *dev)
{ {
struct tmio_nand_data *data = dev->dev.platform_data; struct tmio_nand_data *data = dev_get_platdata(&dev->dev);
struct resource *fcr = platform_get_resource(dev, struct resource *fcr = platform_get_resource(dev,
IORESOURCE_MEM, 0); IORESOURCE_MEM, 0);
struct resource *ccr = platform_get_resource(dev, struct resource *ccr = platform_get_resource(dev,
......
...@@ -87,7 +87,7 @@ static struct platform_device *mtd_to_platdev(struct mtd_info *mtd) ...@@ -87,7 +87,7 @@ static struct platform_device *mtd_to_platdev(struct mtd_info *mtd)
static void __iomem *ndregaddr(struct platform_device *dev, unsigned int reg) static void __iomem *ndregaddr(struct platform_device *dev, unsigned int reg)
{ {
struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev);
struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev);
return drvdata->base + (reg << plat->shift); return drvdata->base + (reg << plat->shift);
} }
...@@ -138,7 +138,7 @@ static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd, ...@@ -138,7 +138,7 @@ static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd,
struct nand_chip *chip = mtd->priv; struct nand_chip *chip = mtd->priv;
struct txx9ndfmc_priv *txx9_priv = chip->priv; struct txx9ndfmc_priv *txx9_priv = chip->priv;
struct platform_device *dev = txx9_priv->dev; struct platform_device *dev = txx9_priv->dev;
struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev);
if (ctrl & NAND_CTRL_CHANGE) { if (ctrl & NAND_CTRL_CHANGE) {
u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR); u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR);
...@@ -225,7 +225,7 @@ static void txx9ndfmc_enable_hwecc(struct mtd_info *mtd, int mode) ...@@ -225,7 +225,7 @@ static void txx9ndfmc_enable_hwecc(struct mtd_info *mtd, int mode)
static void txx9ndfmc_initialize(struct platform_device *dev) static void txx9ndfmc_initialize(struct platform_device *dev)
{ {
struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev);
struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev); struct txx9ndfmc_drvdata *drvdata = platform_get_drvdata(dev);
int tmout = 100; int tmout = 100;
...@@ -274,7 +274,7 @@ static int txx9ndfmc_nand_scan(struct mtd_info *mtd) ...@@ -274,7 +274,7 @@ static int txx9ndfmc_nand_scan(struct mtd_info *mtd)
static int __init txx9ndfmc_probe(struct platform_device *dev) static int __init txx9ndfmc_probe(struct platform_device *dev)
{ {
struct txx9ndfmc_platform_data *plat = dev->dev.platform_data; struct txx9ndfmc_platform_data *plat = dev_get_platdata(&dev->dev);
int hold, spw; int hold, spw;
int i; int i;
struct txx9ndfmc_drvdata *drvdata; struct txx9ndfmc_drvdata *drvdata;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment