Commit 0183984c authored by Jingoo Han's avatar Jingoo Han Committed by Wim Van Sebroeck

watchdog: s3c2410_wdt: convert s3c2410wdt to dev_pm_ops

Instead of using legacy suspend/resume methods, using newer
dev_pm_ops structure allows better control over power management.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Reviewed-by: default avatarGuenter Roeck <linux@roeck-us.net>
Signed-off-by: default avatarWim Van Sebroeck <wim@iguana.be>
parent 3828924a
...@@ -448,12 +448,12 @@ static void s3c2410wdt_shutdown(struct platform_device *dev) ...@@ -448,12 +448,12 @@ static void s3c2410wdt_shutdown(struct platform_device *dev)
s3c2410wdt_stop(&s3c2410_wdd); s3c2410wdt_stop(&s3c2410_wdd);
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static unsigned long wtcon_save; static unsigned long wtcon_save;
static unsigned long wtdat_save; static unsigned long wtdat_save;
static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state) static int s3c2410wdt_suspend(struct device *dev)
{ {
/* Save watchdog state, and turn it off. */ /* Save watchdog state, and turn it off. */
wtcon_save = readl(wdt_base + S3C2410_WTCON); wtcon_save = readl(wdt_base + S3C2410_WTCON);
...@@ -465,7 +465,7 @@ static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state) ...@@ -465,7 +465,7 @@ static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state)
return 0; return 0;
} }
static int s3c2410wdt_resume(struct platform_device *dev) static int s3c2410wdt_resume(struct device *dev)
{ {
/* Restore watchdog state. */ /* Restore watchdog state. */
...@@ -473,16 +473,15 @@ static int s3c2410wdt_resume(struct platform_device *dev) ...@@ -473,16 +473,15 @@ static int s3c2410wdt_resume(struct platform_device *dev)
writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */ writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */
writel(wtcon_save, wdt_base + S3C2410_WTCON); writel(wtcon_save, wdt_base + S3C2410_WTCON);
dev_info(&dev->dev, "watchdog %sabled\n", dev_info(dev, "watchdog %sabled\n",
(wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis"); (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis");
return 0; return 0;
} }
#endif
#else static SIMPLE_DEV_PM_OPS(s3c2410wdt_pm_ops, s3c2410wdt_suspend,
#define s3c2410wdt_suspend NULL s3c2410wdt_resume);
#define s3c2410wdt_resume NULL
#endif /* CONFIG_PM */
#ifdef CONFIG_OF #ifdef CONFIG_OF
static const struct of_device_id s3c2410_wdt_match[] = { static const struct of_device_id s3c2410_wdt_match[] = {
...@@ -496,11 +495,10 @@ static struct platform_driver s3c2410wdt_driver = { ...@@ -496,11 +495,10 @@ static struct platform_driver s3c2410wdt_driver = {
.probe = s3c2410wdt_probe, .probe = s3c2410wdt_probe,
.remove = s3c2410wdt_remove, .remove = s3c2410wdt_remove,
.shutdown = s3c2410wdt_shutdown, .shutdown = s3c2410wdt_shutdown,
.suspend = s3c2410wdt_suspend,
.resume = s3c2410wdt_resume,
.driver = { .driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "s3c2410-wdt", .name = "s3c2410-wdt",
.pm = &s3c2410wdt_pm_ops,
.of_match_table = of_match_ptr(s3c2410_wdt_match), .of_match_table = of_match_ptr(s3c2410_wdt_match),
}, },
}; };
......
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