Commit ded38f87 authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Thierry Reding

pwm: atmel-hlcdc: Use DEFINE_SIMPLE_DEV_PM_OPS for PM functions

This macro has the advantage over SIMPLE_DEV_PM_OPS that we don't have to
care about when the functions are actually used, so the corresponding
#ifdef can be dropped.

Also make use of pm_ptr() to discard all PM related stuff if CONFIG_PM
isn't enabled.
Reviewed-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: default avatarNicolas Ferre <nicolas.ferre@microchip.com>
Signed-off-by: default avatarThierry Reding <thierry.reding@gmail.com>
parent 6c4406ce
...@@ -180,7 +180,6 @@ static const struct atmel_hlcdc_pwm_errata atmel_hlcdc_pwm_sama5d3_errata = { ...@@ -180,7 +180,6 @@ static const struct atmel_hlcdc_pwm_errata atmel_hlcdc_pwm_sama5d3_errata = {
.div1_clk_erratum = true, .div1_clk_erratum = true,
}; };
#ifdef CONFIG_PM_SLEEP
static int atmel_hlcdc_pwm_suspend(struct device *dev) static int atmel_hlcdc_pwm_suspend(struct device *dev)
{ {
struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev); struct atmel_hlcdc_pwm *atmel = dev_get_drvdata(dev);
...@@ -210,10 +209,9 @@ static int atmel_hlcdc_pwm_resume(struct device *dev) ...@@ -210,10 +209,9 @@ static int atmel_hlcdc_pwm_resume(struct device *dev)
return atmel_hlcdc_pwm_apply(&atmel->chip, &atmel->chip.pwms[0], return atmel_hlcdc_pwm_apply(&atmel->chip, &atmel->chip.pwms[0],
&state); &state);
} }
#endif
static SIMPLE_DEV_PM_OPS(atmel_hlcdc_pwm_pm_ops, static DEFINE_SIMPLE_DEV_PM_OPS(atmel_hlcdc_pwm_pm_ops,
atmel_hlcdc_pwm_suspend, atmel_hlcdc_pwm_resume); atmel_hlcdc_pwm_suspend, atmel_hlcdc_pwm_resume);
static const struct of_device_id atmel_hlcdc_dt_ids[] = { static const struct of_device_id atmel_hlcdc_dt_ids[] = {
{ {
...@@ -297,7 +295,7 @@ static struct platform_driver atmel_hlcdc_pwm_driver = { ...@@ -297,7 +295,7 @@ static struct platform_driver atmel_hlcdc_pwm_driver = {
.driver = { .driver = {
.name = "atmel-hlcdc-pwm", .name = "atmel-hlcdc-pwm",
.of_match_table = atmel_hlcdc_pwm_dt_ids, .of_match_table = atmel_hlcdc_pwm_dt_ids,
.pm = &atmel_hlcdc_pwm_pm_ops, .pm = pm_ptr(&atmel_hlcdc_pwm_pm_ops),
}, },
.probe = atmel_hlcdc_pwm_probe, .probe = atmel_hlcdc_pwm_probe,
.remove_new = atmel_hlcdc_pwm_remove, .remove_new = atmel_hlcdc_pwm_remove,
......
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