summaryrefslogtreecommitdiff
path: root/drivers/mfd/stpmic1.c
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2022-10-23 10:48:32 +0100
committerLee Jones <lee@kernel.org>2022-12-07 13:28:11 +0000
commite4b9a17c99d0b45cb4104fd32d170536701214e8 (patch)
treebb7b78c4047d22bbaad8089d01209896d6eb84ff /drivers/mfd/stpmic1.c
parent2662b90fd58b8833894948be07c2f44bfa782ed8 (diff)
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: Paul Cercueil <paul@crapouillou.net> Signed-off-by: Lee Jones <lee@kernel.org>
Diffstat (limited to 'drivers/mfd/stpmic1.c')
-rw-r--r--drivers/mfd/stpmic1.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c
index f5a51171b1b3..54a4d59d1937 100644
--- a/drivers/mfd/stpmic1.c
+++ b/drivers/mfd/stpmic1.c
@@ -161,7 +161,6 @@ static int stpmic1_probe(struct i2c_client *i2c)
return devm_of_platform_populate(dev);
}
-#ifdef CONFIG_PM_SLEEP
static int stpmic1_suspend(struct device *dev)
{
struct i2c_client *i2c = to_i2c_client(dev);
@@ -186,9 +185,8 @@ static int stpmic1_resume(struct device *dev)
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[] = {
{ .compatible = "st,stpmic1", },
@@ -200,7 +198,7 @@ static struct i2c_driver stpmic1_driver = {
.driver = {
.name = "stpmic1",
.of_match_table = of_match_ptr(stpmic1_of_match),
- .pm = &stpmic1_pm,
+ .pm = pm_sleep_ptr(&stpmic1_pm),
},
.probe_new = stpmic1_probe,
};