Commit ca9ea5b6 authored by Komal Shah's avatar Komal Shah Committed by Tony Lindgren

[PATCH] ARM: OMAP: NAND: Use struct platform driver

NAND: Use struct platform_driver
Signed-off-by: default avatarKomal Shah <komal_shah802003@yahoo.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 857e7920
...@@ -68,10 +68,9 @@ static int omap_nand_dev_ready(struct mtd_info *mtd) ...@@ -68,10 +68,9 @@ static int omap_nand_dev_ready(struct mtd_info *mtd)
return info->pdata->dev_ready(info->pdata); return info->pdata->dev_ready(info->pdata);
} }
static int __devinit omap_nand_probe(struct device *dev) static int __devinit omap_nand_probe(struct platform_device *pdev)
{ {
struct omap_nand_info *info; struct omap_nand_info *info;
struct platform_device *pdev = to_platform_device(dev);
struct nand_platform_data *pdata = pdev->dev.platform_data; struct nand_platform_data *pdata = pdev->dev.platform_data;
struct resource *res = pdev->resource; struct resource *res = pdev->resource;
unsigned long size = res->end - res->start + 1; unsigned long size = res->end - res->start + 1;
...@@ -83,7 +82,7 @@ static int __devinit omap_nand_probe(struct device *dev) ...@@ -83,7 +82,7 @@ static int __devinit omap_nand_probe(struct device *dev)
memset(info, 0, sizeof(struct omap_nand_info)); memset(info, 0, sizeof(struct omap_nand_info));
if (!request_mem_region(res->start, size, dev->driver->name)) { if (!request_mem_region(res->start, size, pdev->dev.driver->name)) {
err = -EBUSY; err = -EBUSY;
goto out_free_info; goto out_free_info;
} }
...@@ -129,7 +128,7 @@ static int __devinit omap_nand_probe(struct device *dev) ...@@ -129,7 +128,7 @@ static int __devinit omap_nand_probe(struct device *dev)
#endif #endif
add_mtd_device(&info->mtd); add_mtd_device(&info->mtd);
dev_set_drvdata(&pdev->dev, info); platform_set_drvdata(pdev, info);
return 0; return 0;
...@@ -143,12 +142,11 @@ out_free_info: ...@@ -143,12 +142,11 @@ out_free_info:
return err; return err;
} }
static int __devexit omap_nand_remove(struct device *dev) static int omap_nand_remove(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev); struct omap_nand_info *info = platform_get_drvdata(pdev);
struct omap_nand_info *info = dev_get_drvdata(&pdev->dev);
dev_set_drvdata(&pdev->dev, NULL); platform_set_drvdata(pdev, NULL);
/* Release NAND device, its internal structures and partitions */ /* Release NAND device, its internal structures and partitions */
nand_release(&info->mtd); nand_release(&info->mtd);
iounmap(info->nand.IO_ADDR_R); iounmap(info->nand.IO_ADDR_R);
...@@ -156,22 +154,23 @@ static int __devexit omap_nand_remove(struct device *dev) ...@@ -156,22 +154,23 @@ static int __devexit omap_nand_remove(struct device *dev)
return 0; return 0;
} }
static struct device_driver omap_nand_driver = { static struct platform_driver omap_nand_driver = {
.name = DRIVER_NAME, .probe = omap_nand_probe,
.bus = &platform_bus_type, .remove = omap_nand_remove,
.probe = omap_nand_probe, .driver = {
.remove = __devexit_p(omap_nand_remove), .name = DRIVER_NAME,
},
}; };
MODULE_ALIAS(DRIVER_NAME); MODULE_ALIAS(DRIVER_NAME);
static int __init omap_nand_init(void) static int __init omap_nand_init(void)
{ {
return driver_register(&omap_nand_driver); return platform_driver_register(&omap_nand_driver);
} }
static void __exit omap_nand_exit(void) static void __exit omap_nand_exit(void)
{ {
driver_unregister(&omap_nand_driver); platform_driver_unregister(&omap_nand_driver);
} }
module_init(omap_nand_init); module_init(omap_nand_init);
......
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