mtd: nand: use dev_get_platdata()
authorJingoo Han <jg1.han@samsung.com>
Tue, 30 Jul 2013 08:18:33 +0000 (17:18 +0900)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Fri, 30 Aug 2013 20:34:33 +0000 (21:34 +0100)
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>
18 files changed:
drivers/mtd/nand/atmel_nand.c
drivers/mtd/nand/au1550nd.c
drivers/mtd/nand/bf5xx_nand.c
drivers/mtd/nand/davinci_nand.c
drivers/mtd/nand/gpio.c
drivers/mtd/nand/jz4740_nand.c
drivers/mtd/nand/lpc32xx_mlc.c
drivers/mtd/nand/lpc32xx_slc.c
drivers/mtd/nand/mxc_nand.c
drivers/mtd/nand/omap2.c
drivers/mtd/nand/orion_nand.c
drivers/mtd/nand/plat_nand.c
drivers/mtd/nand/pxa3xx_nand.c
drivers/mtd/nand/s3c2410.c
drivers/mtd/nand/sh_flctl.c
drivers/mtd/nand/sharpsl.c
drivers/mtd/nand/tmio_nand.c
drivers/mtd/nand/txx9ndfmc.c

index ddcd575b2823b6455e5b03101daf48a27b0777d1..1ffa52f7ab4abcfa33c116772265537c40a4054f 100644 (file)
@@ -2023,7 +2023,7 @@ static int __init atmel_nand_probe(struct platform_device *pdev)
                if (res)
                        goto err_nand_ioremap;
        } else {
-               memcpy(&host->board, pdev->dev.platform_data,
+               memcpy(&host->board, dev_get_platdata(&pdev->dev),
                       sizeof(struct atmel_nand_data));
        }
 
index 217459d02b2f85b6d5730e1c0d77e4fac7a108eb..ae8dd7c4103922fc760786be079b7576ad648893 100644 (file)
@@ -411,7 +411,7 @@ static int au1550nd_probe(struct platform_device *pdev)
        struct resource *r;
        int ret, cs;
 
-       pd = pdev->dev.platform_data;
+       pd = dev_get_platdata(&pdev->dev);
        if (!pd) {
                dev_err(&pdev->dev, "missing platform data\n");
                return -ENODEV;
index 809a63c53fc57494baa2ce7ac732b747c3f8d17c..2c42e125720f2141258e064e1fc024fef092057b 100644 (file)
@@ -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)
 {
-       return pdev->dev.platform_data;
+       return dev_get_platdata(&pdev->dev);
 }
 
 /*
index 999ad9cb29012ff6d1d96db1fa33c134d84a133d..b77a01efb4837ea325988ee6e58e82bd128d7892 100644 (file)
@@ -530,7 +530,7 @@ MODULE_DEVICE_TABLE(of, davinci_nand_of_match);
 static struct davinci_nand_pdata
        *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;
                const char *mode;
                u32 prop;
@@ -575,13 +575,13 @@ static struct davinci_nand_pdata
                        pdata->bbt_options = NAND_BBT_USE_FLASH;
        }
 
-       return pdev->dev.platform_data;
+       return dev_get_platdata(&pdev->dev);
 }
 #else
 static struct davinci_nand_pdata
        *nand_davinci_get_pdata(struct platform_device *pdev)
 {
-       return pdev->dev.platform_data;
+       return dev_get_platdata(&pdev->dev);
 }
 #endif
 
index 800a1cc5015d686d191f2cea58eb067a2a2a640e..e826f898241f92b24704ba7103fc0cdd970a63d1 100644 (file)
@@ -167,8 +167,8 @@ static inline int gpio_nand_get_config(const struct device *dev,
        if (!ret)
                return ret;
 
-       if (dev->platform_data) {
-               memcpy(plat, dev->platform_data, sizeof(*plat));
+       if (dev_get_platdata(dev)) {
+               memcpy(plat, dev_get_platdata(dev), sizeof(*plat));
                return 0;
        }
 
@@ -207,7 +207,7 @@ static int gpio_nand_probe(struct platform_device *pdev)
        struct mtd_part_parser_data ppdata = {};
        int ret = 0;
 
-       if (!pdev->dev.of_node && !pdev->dev.platform_data)
+       if (!pdev->dev.of_node && !dev_get_platdata(&pdev->dev))
                return -EINVAL;
 
        gpiomtd = devm_kzalloc(&pdev->dev, sizeof(*gpiomtd), GFP_KERNEL);
index 698a4d1c1f93aabc4f5c34d41fb4f4861fcfd437..a264b888c66cc9153e0f160af0c50e4675826a93 100644 (file)
@@ -411,7 +411,7 @@ static int jz_nand_probe(struct platform_device *pdev)
        struct jz_nand *nand;
        struct nand_chip *chip;
        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;
        uint8_t nand_maf_id = 0, nand_dev_id = 0;
 
@@ -548,7 +548,7 @@ err_free:
 static int jz_nand_remove(struct platform_device *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;
 
        nand_release(&nand->mtd);
index 74a469b83c0d2c04d931b904f00ab402ed092674..f4dd2a887ea5da15b0b64c743f9ecb2603035b97 100644 (file)
@@ -696,7 +696,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
        }
        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 */
        mtd->priv = nand_chip;
index a66f33f259741f21cd45a44bfc04b93ab939eb36..add75709d41550d893f9dc0ef144a8b2edc281f7 100644 (file)
@@ -798,7 +798,7 @@ static int lpc32xx_nand_probe(struct platform_device *pdev)
        }
        lpc32xx_wp_disable(host);
 
-       host->pdata = pdev->dev.platform_data;
+       host->pdata = dev_get_platdata(&pdev->dev);
 
        mtd = &host->mtd;
        chip = &host->nand_chip;
index 0581bd37c49815a35b06661cefa85c09d0138219..a99ff1d6d1ca25cc4fe3d73bb897ebbca7c017f9 100644 (file)
@@ -1432,7 +1432,8 @@ static int mxcnd_probe(struct platform_device *pdev)
 
        err = mxcnd_probe_dt(host);
        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) {
                        host->pdata = *pdata;
                        host->devtype_data = (struct mxc_nand_devtype_data *)
index cb40f87ee93c2e807227ab9e2685d83e8d797e0c..4ecf0e5fd4844d0432d68b0c9981bc9a79531b37 100644 (file)
@@ -1831,7 +1831,7 @@ static int omap_nand_probe(struct platform_device *pdev)
        struct resource                 *res;
        struct mtd_part_parser_data     ppdata = {};
 
-       pdata = pdev->dev.platform_data;
+       pdata = dev_get_platdata(&pdev->dev);
        if (pdata == NULL) {
                dev_err(&pdev->dev, "platform data missing\n");
                return -ENODEV;
index 46f308df84389f7b1def55f06deb501936f45f9d..a393a5b6ce1e5028155a415ae33db88067a7bfff 100644 (file)
@@ -130,8 +130,9 @@ static int __init orion_nand_probe(struct platform_device *pdev)
                if (!of_property_read_u32(pdev->dev.of_node,
                                                "chip-delay", &val))
                        board->chip_delay = (u8)val;
-       } else
-               board = pdev->dev.platform_data;
+       } else {
+               board = dev_get_platdata(&pdev->dev);
+       }
 
        mtd->priv = nc;
        mtd->owner = THIS_MODULE;
index d42700a774e9ab04fa5e87773fc1e56e0d9e738e..cad4cdc9df399a70c77640be5a634b837996790d 100644 (file)
@@ -30,7 +30,7 @@ static const char *part_probe_types[] = { "cmdlinepart", NULL };
  */
 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 plat_nand_data *data;
        struct resource *res;
@@ -136,7 +136,7 @@ out_free:
 static int plat_nand_remove(struct platform_device *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;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
index fdc045d9d2acf44355e7a722f64998fb396fedc6..501e380211e03360700104521de66f9c3196db18 100644 (file)
@@ -815,7 +815,7 @@ static int pxa3xx_nand_config_flash(struct pxa3xx_nand_info *info,
                                    const struct pxa3xx_nand_flash *f)
 {
        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];
        uint32_t ndcr = 0x0; /* enable all interrupts */
 
@@ -958,7 +958,7 @@ static int pxa3xx_nand_scan(struct mtd_info *mtd)
        struct pxa3xx_nand_host *host = mtd->priv;
        struct pxa3xx_nand_info *info = host->info_data;
        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;
        const struct pxa3xx_nand_flash *f = NULL;
        struct nand_chip *chip = mtd->priv;
@@ -1058,7 +1058,7 @@ static int alloc_nand_resource(struct platform_device *pdev)
        struct resource *r;
        int ret, irq, cs;
 
-       pdata = pdev->dev.platform_data;
+       pdata = dev_get_platdata(&pdev->dev);
        info = devm_kzalloc(&pdev->dev, sizeof(*info) + (sizeof(*mtd) +
                            sizeof(*host)) * pdata->num_cs, GFP_KERNEL);
        if (!info)
@@ -1176,7 +1176,7 @@ static int pxa3xx_nand_remove(struct platform_device *pdev)
        if (!info)
                return 0;
 
-       pdata = pdev->dev.platform_data;
+       pdata = dev_get_platdata(&pdev->dev);
 
        irq = platform_get_irq(pdev, 0);
        if (irq >= 0)
@@ -1239,7 +1239,7 @@ static int pxa3xx_nand_probe(struct platform_device *pdev)
        if (ret)
                return ret;
 
-       pdata = pdev->dev.platform_data;
+       pdata = dev_get_platdata(&pdev->dev);
        if (!pdata) {
                dev_err(&pdev->dev, "no platform data defined\n");
                return -ENODEV;
@@ -1286,7 +1286,7 @@ static int pxa3xx_nand_suspend(struct platform_device *pdev, pm_message_t state)
        struct mtd_info *mtd;
        int cs;
 
-       pdata = pdev->dev.platform_data;
+       pdata = dev_get_platdata(&pdev->dev);
        if (info->state) {
                dev_err(&pdev->dev, "driver busy, state = %d\n", info->state);
                return -EAGAIN;
@@ -1307,7 +1307,7 @@ static int pxa3xx_nand_resume(struct platform_device *pdev)
        struct mtd_info *mtd;
        int cs;
 
-       pdata = pdev->dev.platform_data;
+       pdata = dev_get_platdata(&pdev->dev);
        /* We don't want to handle interrupt without calling mtd routine */
        disable_int(info, NDCR_INT_MASK);
 
index 191823ed706eaac294242bd026c54d196d6c8cca..d65cbe903d4015e37076f0505db987ee4383e0d5 100644 (file)
@@ -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)
 {
-       return dev->dev.platform_data;
+       return dev_get_platdata(&dev->dev);
 }
 
 static inline int allow_clk_suspend(struct s3c2410_nand_info *info)
index e57e18e8c2893ab8077693e13385bb06ddaad9af..a3c84ebbe39227dac06bae3d0f9014849cf48b17 100644 (file)
@@ -137,7 +137,7 @@ static void flctl_setup_dma(struct sh_flctl *flctl)
        dma_cap_mask_t mask;
        struct dma_slave_config cfg;
        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;
 
        if (!pdata)
@@ -1131,7 +1131,7 @@ static int flctl_probe(struct platform_device *pdev)
        if (pdev->dev.of_node)
                pdata = flctl_parse_dt(&pdev->dev);
        else
-               pdata = pdev->dev.platform_data;
+               pdata = dev_get_platdata(&pdev->dev);
 
        if (!pdata) {
                dev_err(&pdev->dev, "no setup data defined\n");
index 1d41578d03361222120f1ab45ce56ded8cef5b5b..87908d760feb067c3cb179b35bfa5a3c462ab737 100644 (file)
@@ -112,7 +112,7 @@ static int sharpsl_nand_probe(struct platform_device *pdev)
        struct resource *r;
        int err = 0;
        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) {
                dev_err(&pdev->dev, "no platform data!\n");
index 508e9e04b0926a5b16c4620dc1f2a821e945680d..396530d87ecfb824f5e7a4ede7a92e6c8f0d3a82 100644 (file)
@@ -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)
 {
-       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,
                        IORESOURCE_MEM, 0);
        struct resource *ccr = platform_get_resource(dev,
index 0488dd5ea2f75752eedc498d334fa029df7e10aa..440b5701cb8eb10c2b0c3fb6c1744f73ec371102 100644 (file)
@@ -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)
 {
        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);
 }
@@ -138,7 +138,7 @@ static void txx9ndfmc_cmd_ctrl(struct mtd_info *mtd, int cmd,
        struct nand_chip *chip = mtd->priv;
        struct txx9ndfmc_priv *txx9_priv = chip->priv;
        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) {
                u32 mcr = txx9ndfmc_read(dev, TXX9_NDFMCR);
@@ -225,7 +225,7 @@ static void txx9ndfmc_enable_hwecc(struct mtd_info *mtd, int mode)
 
 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);
        int tmout = 100;
 
@@ -274,7 +274,7 @@ static int txx9ndfmc_nand_scan(struct mtd_info *mtd)
 
 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 i;
        struct txx9ndfmc_drvdata *drvdata;