From 636831fe039070a1647613358a42e6cdce15c04c Mon Sep 17 00:00:00 2001 From: Komal Shah Date: Mon, 28 Nov 2005 19:04:30 -0800 Subject: [PATCH] [PATCH] ARM: OMAP: omap-wdt: Use struct platform_driver omap-wdt: Use struct platform_driver Signed-off-by: Komal Shah Signed-off-by: Tony Lindgren --- drivers/char/watchdog/omap_wdt.c | 45 ++++++++++++++++---------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/drivers/char/watchdog/omap_wdt.c b/drivers/char/watchdog/omap_wdt.c index 16f9b81f2fd..9904165fe60 100644 --- a/drivers/char/watchdog/omap_wdt.c +++ b/drivers/char/watchdog/omap_wdt.c @@ -238,9 +238,8 @@ static struct miscdevice omap_wdt_miscdev = { .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; int ret; @@ -254,12 +253,12 @@ static int __init omap_wdt_probe(struct device *dev) if (mem == NULL) return -EBUSY; - dev_set_drvdata(dev, mem); + platform_set_drvdata(pdev, mem); omap_wdt_users = 0; if (cpu_is_omap16xx()) { - armwdt_ck = clk_get(dev, "armwdt_ck"); + armwdt_ck = clk_get(&pdev->dev, "armwdt_ck"); if (IS_ERR(armwdt_ck)) { ret = PTR_ERR(armwdt_ck); armwdt_ck = NULL; @@ -268,13 +267,13 @@ static int __init omap_wdt_probe(struct device *dev) } 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)) { ret = PTR_ERR(mpu_wdt_ick); mpu_wdt_ick = NULL; 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)) { ret = PTR_ERR(mpu_wdt_fck); mpu_wdt_fck = NULL; @@ -285,7 +284,7 @@ static int __init omap_wdt_probe(struct device *dev) omap_wdt_disable(); omap_wdt_adjust_timeout(timer_margin); - omap_wdt_miscdev.dev = dev; + omap_wdt_miscdev.dev = &pdev->dev; ret = misc_register(&omap_wdt_miscdev); if (ret) goto fail; @@ -307,14 +306,14 @@ fail: return ret; } -static void omap_wdt_shutdown(struct device *dev) +static void omap_wdt_shutdown(struct platform_device *pdev) { 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); release_resource(mem); if (armwdt_ck) @@ -334,14 +333,14 @@ static int __exit omap_wdt_remove(struct device *dev) * 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) omap_wdt_disable(); return 0; } -static int omap_wdt_resume(struct device *dev) +static int omap_wdt_resume(struct platform_device *pdev) { if (omap_wdt_users) { omap_wdt_enable(); @@ -355,24 +354,26 @@ static int omap_wdt_resume(struct device *dev) #define omap_wdt_resume NULL #endif -static struct device_driver omap_wdt_driver = { - .name = "omap_wdt", - .bus = &platform_bus_type, - .probe = omap_wdt_probe, - .shutdown = omap_wdt_shutdown, - .remove = __exit_p(omap_wdt_remove), - .suspend = omap_wdt_suspend, - .resume = omap_wdt_resume, +static struct platform_driver omap_wdt_driver = { + .probe = omap_wdt_probe, + .remove = omap_wdt_remove, + .shutdown = omap_wdt_shutdown, + .suspend = omap_wdt_suspend, + .resume = omap_wdt_resume, + .driver = { + .owner = THIS_MODULE, + .name = "omap-wdt", + }, }; 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) { - driver_unregister(&omap_wdt_driver); + platform_driver_unregister(&omap_wdt_driver); } module_init(omap_wdt_init); -- 2.41.1