diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-03-13 21:31:21 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2013-07-11 15:06:53 -0400 |
commit | 0183984c61fdd298dde717ff1c5c2f6ce2ef3f73 (patch) | |
tree | 618fe1176c231c66b8811278c60b18c0629ecb6f /drivers/watchdog/s3c2410_wdt.c | |
parent | 3828924af2e24a615b302fe1da69527d58474cdc (diff) |
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: Jingoo Han <jg1.han@samsung.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'drivers/watchdog/s3c2410_wdt.c')
-rw-r--r-- | drivers/watchdog/s3c2410_wdt.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c index c3beb3adc6f7..6a22cf5d35bd 100644 --- a/drivers/watchdog/s3c2410_wdt.c +++ b/drivers/watchdog/s3c2410_wdt.c | |||
@@ -448,12 +448,12 @@ static void s3c2410wdt_shutdown(struct platform_device *dev) | |||
448 | s3c2410wdt_stop(&s3c2410_wdd); | 448 | s3c2410wdt_stop(&s3c2410_wdd); |
449 | } | 449 | } |
450 | 450 | ||
451 | #ifdef CONFIG_PM | 451 | #ifdef CONFIG_PM_SLEEP |
452 | 452 | ||
453 | static unsigned long wtcon_save; | 453 | static unsigned long wtcon_save; |
454 | static unsigned long wtdat_save; | 454 | static unsigned long wtdat_save; |
455 | 455 | ||
456 | static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state) | 456 | static int s3c2410wdt_suspend(struct device *dev) |
457 | { | 457 | { |
458 | /* Save watchdog state, and turn it off. */ | 458 | /* Save watchdog state, and turn it off. */ |
459 | wtcon_save = readl(wdt_base + S3C2410_WTCON); | 459 | wtcon_save = readl(wdt_base + S3C2410_WTCON); |
@@ -465,7 +465,7 @@ static int s3c2410wdt_suspend(struct platform_device *dev, pm_message_t state) | |||
465 | return 0; | 465 | return 0; |
466 | } | 466 | } |
467 | 467 | ||
468 | static int s3c2410wdt_resume(struct platform_device *dev) | 468 | static int s3c2410wdt_resume(struct device *dev) |
469 | { | 469 | { |
470 | /* Restore watchdog state. */ | 470 | /* Restore watchdog state. */ |
471 | 471 | ||
@@ -473,16 +473,15 @@ static int s3c2410wdt_resume(struct platform_device *dev) | |||
473 | writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */ | 473 | writel(wtdat_save, wdt_base + S3C2410_WTCNT); /* Reset count */ |
474 | writel(wtcon_save, wdt_base + S3C2410_WTCON); | 474 | writel(wtcon_save, wdt_base + S3C2410_WTCON); |
475 | 475 | ||
476 | dev_info(&dev->dev, "watchdog %sabled\n", | 476 | dev_info(dev, "watchdog %sabled\n", |
477 | (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis"); | 477 | (wtcon_save & S3C2410_WTCON_ENABLE) ? "en" : "dis"); |
478 | 478 | ||
479 | return 0; | 479 | return 0; |
480 | } | 480 | } |
481 | #endif | ||
481 | 482 | ||
482 | #else | 483 | static SIMPLE_DEV_PM_OPS(s3c2410wdt_pm_ops, s3c2410wdt_suspend, |
483 | #define s3c2410wdt_suspend NULL | 484 | s3c2410wdt_resume); |
484 | #define s3c2410wdt_resume NULL | ||
485 | #endif /* CONFIG_PM */ | ||
486 | 485 | ||
487 | #ifdef CONFIG_OF | 486 | #ifdef CONFIG_OF |
488 | static const struct of_device_id s3c2410_wdt_match[] = { | 487 | static const struct of_device_id s3c2410_wdt_match[] = { |
@@ -496,11 +495,10 @@ static struct platform_driver s3c2410wdt_driver = { | |||
496 | .probe = s3c2410wdt_probe, | 495 | .probe = s3c2410wdt_probe, |
497 | .remove = s3c2410wdt_remove, | 496 | .remove = s3c2410wdt_remove, |
498 | .shutdown = s3c2410wdt_shutdown, | 497 | .shutdown = s3c2410wdt_shutdown, |
499 | .suspend = s3c2410wdt_suspend, | ||
500 | .resume = s3c2410wdt_resume, | ||
501 | .driver = { | 498 | .driver = { |
502 | .owner = THIS_MODULE, | 499 | .owner = THIS_MODULE, |
503 | .name = "s3c2410-wdt", | 500 | .name = "s3c2410-wdt", |
501 | .pm = &s3c2410wdt_pm_ops, | ||
504 | .of_match_table = of_match_ptr(s3c2410_wdt_match), | 502 | .of_match_table = of_match_ptr(s3c2410_wdt_match), |
505 | }, | 503 | }, |
506 | }; | 504 | }; |