Commit e4b9a17c authored by Paul Cercueil's avatar Paul Cercueil Committed by Lee Jones

mfd: stpmic1: Remove #ifdef guards for PM related functions

Use the new DEFINE_SIMPLE_DEV_PM_OPS() and pm_sleep_ptr() macros
to handle the .suspend/.resume callbacks.

These macros allow the suspend and resume functions to be automatically
dropped by the compiler when CONFIG_SUSPEND is disabled, without having
to use #ifdef guards.

This has the advantage of always compiling these functions in,
independently of any Kconfig option. Thanks to that, bugs and other
regressions are subsequently easier to catch.
Signed-off-by: default avatarPaul Cercueil <paul@crapouillou.net>
Signed-off-by: default avatarLee Jones <lee@kernel.org>
parent 2662b90f
...@@ -161,7 +161,6 @@ static int stpmic1_probe(struct i2c_client *i2c) ...@@ -161,7 +161,6 @@ static int stpmic1_probe(struct i2c_client *i2c)
return devm_of_platform_populate(dev); return devm_of_platform_populate(dev);
} }
#ifdef CONFIG_PM_SLEEP
static int stpmic1_suspend(struct device *dev) static int stpmic1_suspend(struct device *dev)
{ {
struct i2c_client *i2c = to_i2c_client(dev); struct i2c_client *i2c = to_i2c_client(dev);
...@@ -186,9 +185,8 @@ static int stpmic1_resume(struct device *dev) ...@@ -186,9 +185,8 @@ static int stpmic1_resume(struct device *dev)
return 0; return 0;
} }
#endif
static SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume); static DEFINE_SIMPLE_DEV_PM_OPS(stpmic1_pm, stpmic1_suspend, stpmic1_resume);
static const struct of_device_id stpmic1_of_match[] = { static const struct of_device_id stpmic1_of_match[] = {
{ .compatible = "st,stpmic1", }, { .compatible = "st,stpmic1", },
...@@ -200,7 +198,7 @@ static struct i2c_driver stpmic1_driver = { ...@@ -200,7 +198,7 @@ static struct i2c_driver stpmic1_driver = {
.driver = { .driver = {
.name = "stpmic1", .name = "stpmic1",
.of_match_table = of_match_ptr(stpmic1_of_match), .of_match_table = of_match_ptr(stpmic1_of_match),
.pm = &stpmic1_pm, .pm = pm_sleep_ptr(&stpmic1_pm),
}, },
.probe_new = stpmic1_probe, .probe_new = stpmic1_probe,
}; };
......
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