summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Cercueil <paul@crapouillou.net>2022-10-23 11:48:35 +0200
committerLee Jones <lee@kernel.org>2022-12-07 14:28:11 +0100
commitff84723e5291c51ac23429d267ab9107e14ee486 (patch)
tree1ce5fea7da80db41259d22c138252d351bf96ea1
parentmfd: 88pm860x: Remove #ifdef guards for PM related functions (diff)
downloadlinux-ff84723e5291c51ac23429d267ab9107e14ee486.tar.xz
linux-ff84723e5291c51ac23429d267ab9107e14ee486.zip
mfd: mcp-sa11x0: Remove #ifdef guards for PM related functions
Use the new pm_sleep_ptr() macro to handle the .suspend/.resume callbacks. This macro 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>
-rw-r--r--drivers/mfd/mcp-sa11x0.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/mfd/mcp-sa11x0.c b/drivers/mfd/mcp-sa11x0.c
index 4629dff187cd..1c9831b78cf9 100644
--- a/drivers/mfd/mcp-sa11x0.c
+++ b/drivers/mfd/mcp-sa11x0.c
@@ -255,7 +255,6 @@ static int mcp_sa11x0_remove(struct platform_device *dev)
return 0;
}
-#ifdef CONFIG_PM_SLEEP
static int mcp_sa11x0_suspend(struct device *dev)
{
struct mcp_sa11x0 *m = priv(dev_get_drvdata(dev));
@@ -277,17 +276,14 @@ static int mcp_sa11x0_resume(struct device *dev)
return 0;
}
-#endif
static const struct dev_pm_ops mcp_sa11x0_pm_ops = {
-#ifdef CONFIG_PM_SLEEP
.suspend = mcp_sa11x0_suspend,
.freeze = mcp_sa11x0_suspend,
.poweroff = mcp_sa11x0_suspend,
.resume_noirq = mcp_sa11x0_resume,
.thaw_noirq = mcp_sa11x0_resume,
.restore_noirq = mcp_sa11x0_resume,
-#endif
};
static struct platform_driver mcp_sa11x0_driver = {
@@ -295,7 +291,7 @@ static struct platform_driver mcp_sa11x0_driver = {
.remove = mcp_sa11x0_remove,
.driver = {
.name = DRIVER_NAME,
- .pm = &mcp_sa11x0_pm_ops,
+ .pm = pm_sleep_ptr(&mcp_sa11x0_pm_ops),
},
};