Commit 636831fe authored by Komal Shah's avatar Komal Shah Committed by Tony Lindgren

[PATCH] ARM: OMAP: omap-wdt: Use struct platform_driver

omap-wdt: Use struct platform_driver
Signed-off-by: default avatarKomal Shah <komal_shah802003@yahoo.com>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 6cfc676c
...@@ -238,9 +238,8 @@ static struct miscdevice omap_wdt_miscdev = { ...@@ -238,9 +238,8 @@ static struct miscdevice omap_wdt_miscdev = {
.fops = &omap_wdt_fops .fops = &omap_wdt_fops
}; };
static int __init omap_wdt_probe(struct device *dev) static int __init omap_wdt_probe(struct platform_device *pdev)
{ {
struct platform_device *pdev = to_platform_device(dev);
struct resource *res, *mem; struct resource *res, *mem;
int ret; int ret;
...@@ -254,12 +253,12 @@ static int __init omap_wdt_probe(struct device *dev) ...@@ -254,12 +253,12 @@ static int __init omap_wdt_probe(struct device *dev)
if (mem == NULL) if (mem == NULL)
return -EBUSY; return -EBUSY;
dev_set_drvdata(dev, mem); platform_set_drvdata(pdev, mem);
omap_wdt_users = 0; omap_wdt_users = 0;
if (cpu_is_omap16xx()) { if (cpu_is_omap16xx()) {
armwdt_ck = clk_get(dev, "armwdt_ck"); armwdt_ck = clk_get(&pdev->dev, "armwdt_ck");
if (IS_ERR(armwdt_ck)) { if (IS_ERR(armwdt_ck)) {
ret = PTR_ERR(armwdt_ck); ret = PTR_ERR(armwdt_ck);
armwdt_ck = NULL; armwdt_ck = NULL;
...@@ -268,13 +267,13 @@ static int __init omap_wdt_probe(struct device *dev) ...@@ -268,13 +267,13 @@ static int __init omap_wdt_probe(struct device *dev)
} }
if (cpu_is_omap24xx()) { if (cpu_is_omap24xx()) {
mpu_wdt_ick = clk_get(dev, "mpu_wdt_ick"); mpu_wdt_ick = clk_get(&pdev->dev, "mpu_wdt_ick");
if (IS_ERR(mpu_wdt_ick)) { if (IS_ERR(mpu_wdt_ick)) {
ret = PTR_ERR(mpu_wdt_ick); ret = PTR_ERR(mpu_wdt_ick);
mpu_wdt_ick = NULL; mpu_wdt_ick = NULL;
goto fail; goto fail;
} }
mpu_wdt_fck = clk_get(dev, "mpu_wdt_fck"); mpu_wdt_fck = clk_get(&pdev->dev, "mpu_wdt_fck");
if (IS_ERR(mpu_wdt_fck)) { if (IS_ERR(mpu_wdt_fck)) {
ret = PTR_ERR(mpu_wdt_fck); ret = PTR_ERR(mpu_wdt_fck);
mpu_wdt_fck = NULL; mpu_wdt_fck = NULL;
...@@ -285,7 +284,7 @@ static int __init omap_wdt_probe(struct device *dev) ...@@ -285,7 +284,7 @@ static int __init omap_wdt_probe(struct device *dev)
omap_wdt_disable(); omap_wdt_disable();
omap_wdt_adjust_timeout(timer_margin); omap_wdt_adjust_timeout(timer_margin);
omap_wdt_miscdev.dev = dev; omap_wdt_miscdev.dev = &pdev->dev;
ret = misc_register(&omap_wdt_miscdev); ret = misc_register(&omap_wdt_miscdev);
if (ret) if (ret)
goto fail; goto fail;
...@@ -307,14 +306,14 @@ fail: ...@@ -307,14 +306,14 @@ fail:
return ret; return ret;
} }
static void omap_wdt_shutdown(struct device *dev) static void omap_wdt_shutdown(struct platform_device *pdev)
{ {
omap_wdt_disable(); omap_wdt_disable();
} }
static int __exit omap_wdt_remove(struct device *dev) static int omap_wdt_remove(struct platform_device *pdev)
{ {
struct resource *mem = dev_get_drvdata(dev); struct resource *mem = platform_get_drvdata(pdev);
misc_deregister(&omap_wdt_miscdev); misc_deregister(&omap_wdt_miscdev);
release_resource(mem); release_resource(mem);
if (armwdt_ck) if (armwdt_ck)
...@@ -334,14 +333,14 @@ static int __exit omap_wdt_remove(struct device *dev) ...@@ -334,14 +333,14 @@ static int __exit omap_wdt_remove(struct device *dev)
* may not play well enough with NOWAYOUT... * may not play well enough with NOWAYOUT...
*/ */
static int omap_wdt_suspend(struct device *dev, pm_message_t state) static int omap_wdt_suspend(struct platform_device *pdev, pm_message_t state)
{ {
if (omap_wdt_users) if (omap_wdt_users)
omap_wdt_disable(); omap_wdt_disable();
return 0; return 0;
} }
static int omap_wdt_resume(struct device *dev) static int omap_wdt_resume(struct platform_device *pdev)
{ {
if (omap_wdt_users) { if (omap_wdt_users) {
omap_wdt_enable(); omap_wdt_enable();
...@@ -355,24 +354,26 @@ static int omap_wdt_resume(struct device *dev) ...@@ -355,24 +354,26 @@ static int omap_wdt_resume(struct device *dev)
#define omap_wdt_resume NULL #define omap_wdt_resume NULL
#endif #endif
static struct device_driver omap_wdt_driver = { static struct platform_driver omap_wdt_driver = {
.name = "omap_wdt",
.bus = &platform_bus_type,
.probe = omap_wdt_probe, .probe = omap_wdt_probe,
.remove = omap_wdt_remove,
.shutdown = omap_wdt_shutdown, .shutdown = omap_wdt_shutdown,
.remove = __exit_p(omap_wdt_remove),
.suspend = omap_wdt_suspend, .suspend = omap_wdt_suspend,
.resume = omap_wdt_resume, .resume = omap_wdt_resume,
.driver = {
.owner = THIS_MODULE,
.name = "omap-wdt",
},
}; };
static int __init omap_wdt_init(void) static int __init omap_wdt_init(void)
{ {
return driver_register(&omap_wdt_driver); return platform_driver_register(&omap_wdt_driver);
} }
static void __exit omap_wdt_exit(void) static void __exit omap_wdt_exit(void)
{ {
driver_unregister(&omap_wdt_driver); platform_driver_unregister(&omap_wdt_driver);
} }
module_init(omap_wdt_init); module_init(omap_wdt_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