[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220807145247.46107-26-paul@crapouillou.net>
Date: Sun, 7 Aug 2022 16:52:44 +0200
From: Paul Cercueil <paul@...pouillou.net>
To: Lee Jones <lee.jones@...aro.org>
Cc: linux-kernel@...r.kernel.org, Paul Cercueil <paul@...pouillou.net>,
Maxime Coquelin <mcoquelin.stm32@...il.com>,
Alexandre Torgue <alexandre.torgue@...s.st.com>,
linux-stm32@...md-mailman.stormreply.com,
linux-arm-kernel@...ts.infradead.org
Subject: [PATCH 25/28] mfd: stmfx: 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.
The advantage is then that these functions are now always compiled
independently of any Kconfig option, and thanks to that bugs and
regressions are easier to catch.
Signed-off-by: Paul Cercueil <paul@...pouillou.net>
Cc: Maxime Coquelin <mcoquelin.stm32@...il.com>
Cc: Alexandre Torgue <alexandre.torgue@...s.st.com>
Cc: linux-stm32@...md-mailman.stormreply.com
Cc: linux-arm-kernel@...ts.infradead.org
---
drivers/mfd/stmfx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mfd/stmfx.c b/drivers/mfd/stmfx.c
index 122f96094410..94af27346669 100644
--- a/drivers/mfd/stmfx.c
+++ b/drivers/mfd/stmfx.c
@@ -476,7 +476,6 @@ static int stmfx_remove(struct i2c_client *client)
return 0;
}
-#ifdef CONFIG_PM_SLEEP
static int stmfx_suspend(struct device *dev)
{
struct stmfx *stmfx = dev_get_drvdata(dev);
@@ -542,9 +541,8 @@ static int stmfx_resume(struct device *dev)
return 0;
}
-#endif
-static SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stmfx_dev_pm_ops, stmfx_suspend, stmfx_resume);
static const struct of_device_id stmfx_of_match[] = {
{ .compatible = "st,stmfx-0300", },
@@ -556,7 +554,7 @@ static struct i2c_driver stmfx_driver = {
.driver = {
.name = "stmfx-core",
.of_match_table = stmfx_of_match,
- .pm = &stmfx_dev_pm_ops,
+ .pm = pm_sleep_ptr(&stmfx_dev_pm_ops),
},
.probe = stmfx_probe,
.remove = stmfx_remove,
--
2.35.1
Powered by blists - more mailing lists