Commit c509a8e5 authored by Jingoo Han's avatar Jingoo Han Committed by Thierry Reding

pwm: samsung: convert s3c_pwm 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>
Signed-off-by: default avatarThierry Reding <thierry.reding@avionic-design.de>
parent 482467ad
...@@ -289,10 +289,10 @@ static int s3c_pwm_remove(struct platform_device *pdev) ...@@ -289,10 +289,10 @@ static int s3c_pwm_remove(struct platform_device *pdev)
return 0; return 0;
} }
#ifdef CONFIG_PM #ifdef CONFIG_PM_SLEEP
static int s3c_pwm_suspend(struct platform_device *pdev, pm_message_t state) static int s3c_pwm_suspend(struct device *dev)
{ {
struct s3c_chip *s3c = platform_get_drvdata(pdev); struct s3c_chip *s3c = dev_get_drvdata(dev);
/* No one preserve these values during suspend so reset them /* No one preserve these values during suspend so reset them
* Otherwise driver leaves PWM unconfigured if same values * Otherwise driver leaves PWM unconfigured if same values
...@@ -304,9 +304,9 @@ static int s3c_pwm_suspend(struct platform_device *pdev, pm_message_t state) ...@@ -304,9 +304,9 @@ static int s3c_pwm_suspend(struct platform_device *pdev, pm_message_t state)
return 0; return 0;
} }
static int s3c_pwm_resume(struct platform_device *pdev) static int s3c_pwm_resume(struct device *dev)
{ {
struct s3c_chip *s3c = platform_get_drvdata(pdev); struct s3c_chip *s3c = dev_get_drvdata(dev);
unsigned long tcon; unsigned long tcon;
/* Restore invertion */ /* Restore invertion */
...@@ -316,21 +316,19 @@ static int s3c_pwm_resume(struct platform_device *pdev) ...@@ -316,21 +316,19 @@ static int s3c_pwm_resume(struct platform_device *pdev)
return 0; return 0;
} }
#else
#define s3c_pwm_suspend NULL
#define s3c_pwm_resume NULL
#endif #endif
static SIMPLE_DEV_PM_OPS(s3c_pwm_pm_ops, s3c_pwm_suspend,
s3c_pwm_resume);
static struct platform_driver s3c_pwm_driver = { static struct platform_driver s3c_pwm_driver = {
.driver = { .driver = {
.name = "s3c24xx-pwm", .name = "s3c24xx-pwm",
.owner = THIS_MODULE, .owner = THIS_MODULE,
.pm = &s3c_pwm_pm_ops,
}, },
.probe = s3c_pwm_probe, .probe = s3c_pwm_probe,
.remove = s3c_pwm_remove, .remove = s3c_pwm_remove,
.suspend = s3c_pwm_suspend,
.resume = s3c_pwm_resume,
}; };
static int __init pwm_init(void) static int __init pwm_init(void)
......
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