diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/maps/pxa2xx-flash.c | 37 | ||||
-rw-r--r-- | drivers/mtd/nand/excite_nandflash.c | 25 | ||||
-rw-r--r-- | drivers/mtd/nand/ndfc.c | 2 | ||||
-rw-r--r-- | drivers/mtd/onenand/generic.c | 26 |
4 files changed, 46 insertions, 44 deletions
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c index 771139c5bf8..e9026cb1c5b 100644 --- a/drivers/mtd/maps/pxa2xx-flash.c +++ b/drivers/mtd/maps/pxa2xx-flash.c @@ -41,9 +41,8 @@ struct pxa2xx_flash_info { static const char *probes[] = { "RedBoot", "cmdlinepart", NULL }; -static int __init pxa2xx_flash_probe(struct device *dev) +static int __init pxa2xx_flash_probe(struct platform_device *pdev) { - struct platform_device *pdev = to_platform_device(dev); struct flash_platform_data *flash = pdev->dev.platform_data; struct pxa2xx_flash_info *info; struct mtd_partition *parts; @@ -114,15 +113,15 @@ static int __init pxa2xx_flash_probe(struct device *dev) add_mtd_device(info->mtd); } - dev_set_drvdata(dev, info); + platform_set_drvdata(pdev, info); return 0; } -static int __exit pxa2xx_flash_remove(struct device *dev) +static int __exit pxa2xx_flash_remove(struct platform_device *dev) { - struct pxa2xx_flash_info *info = dev_get_drvdata(dev); + struct pxa2xx_flash_info *info = platform_get_drvdata(dev); - dev_set_drvdata(dev, NULL); + platform_set_drvdata(dev, NULL); #ifdef CONFIG_MTD_PARTITIONS if (info->nr_parts) @@ -141,9 +140,9 @@ static int __exit pxa2xx_flash_remove(struct device *dev) } #ifdef CONFIG_PM -static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state) +static int pxa2xx_flash_suspend(struct platform_device *dev, pm_message_t state) { - struct pxa2xx_flash_info *info = dev_get_drvdata(dev); + struct pxa2xx_flash_info *info = platform_get_drvdata(dev); int ret = 0; if (info->mtd && info->mtd->suspend) @@ -151,17 +150,17 @@ static int pxa2xx_flash_suspend(struct device *dev, pm_message_t state) return ret; } -static int pxa2xx_flash_resume(struct device *dev) +static int pxa2xx_flash_resume(struct platform_device *dev) { - struct pxa2xx_flash_info *info = dev_get_drvdata(dev); + struct pxa2xx_flash_info *info = platform_get_drvdata(dev); if (info->mtd && info->mtd->resume) info->mtd->resume(info->mtd); return 0; } -static void pxa2xx_flash_shutdown(struct device *dev) +static void pxa2xx_flash_shutdown(struct platform_device *dev) { - struct pxa2xx_flash_info *info = dev_get_drvdata(dev); + struct pxa2xx_flash_info *info = platform_get_drvdata(dev); if (info && info->mtd->suspend(info->mtd) == 0) info->mtd->resume(info->mtd); @@ -172,11 +171,13 @@ static void pxa2xx_flash_shutdown(struct device *dev) #define pxa2xx_flash_shutdown NULL #endif -static struct device_driver pxa2xx_flash_driver = { - .name = "pxa2xx-flash", - .bus = &platform_bus_type, +static struct platform_driver pxa2xx_flash_driver = { + .driver = { + .name = "pxa2xx-flash", + .owner = THIS_MODULE, + }, .probe = pxa2xx_flash_probe, - .remove = __exit_p(pxa2xx_flash_remove), + .remove = __devexit_p(pxa2xx_flash_remove), .suspend = pxa2xx_flash_suspend, .resume = pxa2xx_flash_resume, .shutdown = pxa2xx_flash_shutdown, @@ -184,12 +185,12 @@ static struct device_driver pxa2xx_flash_driver = { static int __init init_pxa2xx_flash(void) { - return driver_register(&pxa2xx_flash_driver); + return platform_driver_register(&pxa2xx_flash_driver); } static void __exit cleanup_pxa2xx_flash(void) { - driver_unregister(&pxa2xx_flash_driver); + platform_driver_unregister(&pxa2xx_flash_driver); } module_init(init_pxa2xx_flash); diff --git a/drivers/mtd/nand/excite_nandflash.c b/drivers/mtd/nand/excite_nandflash.c index ced14b5294d..72446fb48d4 100644 --- a/drivers/mtd/nand/excite_nandflash.c +++ b/drivers/mtd/nand/excite_nandflash.c @@ -128,11 +128,11 @@ static int excite_nand_devready(struct mtd_info *mtd) * The binding to the mtd and all allocated * resources are released. */ -static int __exit excite_nand_remove(struct device *dev) +static int __exit excite_nand_remove(struct platform_device *dev) { - struct excite_nand_drvdata * const this = dev_get_drvdata(dev); + struct excite_nand_drvdata * const this = platform_get_drvdata(dev); - dev_set_drvdata(dev, NULL); + platform_set_drvdata(dev, NULL); if (unlikely(!this)) { printk(KERN_ERR "%s: called %s without private data!!", @@ -159,9 +159,8 @@ static int __exit excite_nand_remove(struct device *dev) * it can allocate all necessary resources then calls the * nand layer to look for devices. */ -static int __init excite_nand_probe(struct device *dev) +static int __init excite_nand_probe(struct platform_device *pdev) { - struct platform_device * const pdev = to_platform_device(dev); struct excite_nand_drvdata *drvdata; /* private driver data */ struct nand_chip *board_chip; /* private flash chip data */ struct mtd_info *board_mtd; /* mtd info for this board */ @@ -175,7 +174,7 @@ static int __init excite_nand_probe(struct device *dev) } /* bind private data into driver */ - dev_set_drvdata(dev, drvdata); + platform_set_drvdata(pdev, drvdata); /* allocate and map the resource */ drvdata->regs = @@ -219,23 +218,25 @@ static int __init excite_nand_probe(struct device *dev) return 0; } -static struct device_driver excite_nand_driver = { - .name = "excite_nand", - .bus = &platform_bus_type, +static struct platform_driver excite_nand_driver = { + .driver = { + .name = "excite_nand", + .owner = THIS_MODULE, + }, .probe = excite_nand_probe, - .remove = __exit_p(excite_nand_remove) + .remove = __devexit_p(excite_nand_remove) }; static int __init excite_nand_init(void) { pr_info("Basler eXcite nand flash driver Version " EXCITE_NANDFLASH_VERSION "\n"); - return driver_register(&excite_nand_driver); + return platform_driver_register(&excite_nand_driver); } static void __exit excite_nand_exit(void) { - driver_unregister(&excite_nand_driver); + platform_driver_unregister(&excite_nand_driver); } module_init(excite_nand_init); diff --git a/drivers/mtd/nand/ndfc.c b/drivers/mtd/nand/ndfc.c index 582cf80f555..89bf85af642 100644 --- a/drivers/mtd/nand/ndfc.c +++ b/drivers/mtd/nand/ndfc.c @@ -187,7 +187,7 @@ static int ndfc_chip_init(struct ndfc_controller *ndfc, return -ENODEV; ndfc->mtd.name = kasprintf(GFP_KERNEL, "%s.%s", - ndfc->ofdev->dev.bus_id, flash_np->name); + dev_name(&ndfc->ofdev->dev), flash_np->name); if (!ndfc->mtd.name) { ret = -ENOMEM; goto err; diff --git a/drivers/mtd/onenand/generic.c b/drivers/mtd/onenand/generic.c index 5b69e7773c6..3a496c33fb5 100644 --- a/drivers/mtd/onenand/generic.c +++ b/drivers/mtd/onenand/generic.c @@ -36,10 +36,9 @@ struct onenand_info { struct onenand_chip onenand; }; -static int __devinit generic_onenand_probe(struct device *dev) +static int __devinit generic_onenand_probe(struct platform_device *pdev) { struct onenand_info *info; - struct platform_device *pdev = to_platform_device(dev); struct flash_platform_data *pdata = pdev->dev.platform_data; struct resource *res = pdev->resource; unsigned long size = res->end - res->start + 1; @@ -49,7 +48,7 @@ static int __devinit generic_onenand_probe(struct device *dev) if (!info) return -ENOMEM; - if (!request_mem_region(res->start, size, dev->driver->name)) { + if (!request_mem_region(res->start, size, pdev->dev.driver->name)) { err = -EBUSY; goto out_free_info; } @@ -82,7 +81,7 @@ static int __devinit generic_onenand_probe(struct device *dev) #endif err = add_mtd_device(&info->mtd); - dev_set_drvdata(&pdev->dev, info); + platform_set_drvdata(pdev, info); return 0; @@ -96,14 +95,13 @@ out_free_info: return err; } -static int __devexit generic_onenand_remove(struct device *dev) +static int __devexit generic_onenand_remove(struct platform_device *pdev) { - struct platform_device *pdev = to_platform_device(dev); - struct onenand_info *info = dev_get_drvdata(&pdev->dev); + struct onenand_info *info = platform_get_drvdata(pdev); struct resource *res = pdev->resource; unsigned long size = res->end - res->start + 1; - dev_set_drvdata(&pdev->dev, NULL); + platform_set_drvdata(pdev, NULL); if (info) { if (info->parts) @@ -120,9 +118,11 @@ static int __devexit generic_onenand_remove(struct device *dev) return 0; } -static struct device_driver generic_onenand_driver = { - .name = DRIVER_NAME, - .bus = &platform_bus_type, +static struct platform_driver generic_onenand_driver = { + .driver = { + .name = DRIVER_NAME, + .owner = THIS_MODULE, + }, .probe = generic_onenand_probe, .remove = __devexit_p(generic_onenand_remove), }; @@ -131,12 +131,12 @@ MODULE_ALIAS(DRIVER_NAME); static int __init generic_onenand_init(void) { - return driver_register(&generic_onenand_driver); + return platform_driver_register(&generic_onenand_driver); } static void __exit generic_onenand_exit(void) { - driver_unregister(&generic_onenand_driver); + platform_driver_unregister(&generic_onenand_driver); } module_init(generic_onenand_init); |