summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaphael Gallais-Pou <rgallaispou@gmail.com>2025-01-09 16:52:33 +0100
committerMiquel Raynal <miquel.raynal@bootlin.com>2025-01-15 19:10:29 +0100
commit29b9415889d42e6a32ead89cf897f65696d3cb47 (patch)
tree6c7495eb0888af74db593c09ded3f0a04678090e
parentbf5821909eb9c7f5d07d5c6e852ead2c373c94a0 (diff)
downloadlinux-29b9415889d42e6a32ead89cf897f65696d3cb47.tar.gz
linux-29b9415889d42e6a32ead89cf897f65696d3cb47.tar.bz2
linux-29b9415889d42e6a32ead89cf897f65696d3cb47.zip
mtd: st_spi_fsm: Switch from CONFIG_PM_SLEEP guards to pm_sleep_ptr()
Letting the compiler remove these functions when the kernel is built without CONFIG_PM_SLEEP support is simpler and less error prone than the use of #ifdef based kernel configuration guards. Signed-off-by: Raphael Gallais-Pou <rgallaispou@gmail.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
-rw-r--r--drivers/mtd/devices/st_spi_fsm.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/mtd/devices/st_spi_fsm.c b/drivers/mtd/devices/st_spi_fsm.c
index dba584fa2a53..f2266145b821 100644
--- a/drivers/mtd/devices/st_spi_fsm.c
+++ b/drivers/mtd/devices/st_spi_fsm.c
@@ -2104,7 +2104,6 @@ static void stfsm_remove(struct platform_device *pdev)
WARN_ON(mtd_device_unregister(&fsm->mtd));
}
-#ifdef CONFIG_PM_SLEEP
static int stfsmfsm_suspend(struct device *dev)
{
struct stfsm *fsm = dev_get_drvdata(dev);
@@ -2120,9 +2119,8 @@ static int stfsmfsm_resume(struct device *dev)
return clk_prepare_enable(fsm->clk);
}
-#endif
-static SIMPLE_DEV_PM_OPS(stfsm_pm_ops, stfsmfsm_suspend, stfsmfsm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(stfsm_pm_ops, stfsmfsm_suspend, stfsmfsm_resume);
static const struct of_device_id stfsm_match[] = {
{ .compatible = "st,spi-fsm", },
@@ -2136,7 +2134,7 @@ static struct platform_driver stfsm_driver = {
.driver = {
.name = "st-spi-fsm",
.of_match_table = stfsm_match,
- .pm = &stfsm_pm_ops,
+ .pm = pm_sleep_ptr(&stfsm_pm_ops),
},
};
module_platform_driver(stfsm_driver);