[PATCH 03/12] mtd: spear_smi: Remove #ifdef guards for PM related functions
From: Paul Cercueil
Date: Thu Nov 05 2026 - 12:21:45 EST
Use the new PM macros for the suspend and resume functions to be
automatically dropped by the compiler when CONFIG_PM or
CONFIG_PM_SLEEP are 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.cercueil@xxxxxxxxxxx>
---
drivers/mtd/devices/spear_smi.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/devices/spear_smi.c b/drivers/mtd/devices/spear_smi.c
index f02f96bff450..689141e525c0 100644
--- a/drivers/mtd/devices/spear_smi.c
+++ b/drivers/mtd/devices/spear_smi.c
@@ -1050,7 +1050,6 @@ static void spear_smi_remove(struct platform_device *pdev)
}
}
-#ifdef CONFIG_PM_SLEEP
static int spear_smi_suspend(struct device *dev)
{
struct spear_smi *sdev = dev_get_drvdata(dev);
@@ -1073,9 +1072,8 @@ static int spear_smi_resume(struct device *dev)
spear_smi_hw_init(sdev);
return ret;
}
-#endif
-static SIMPLE_DEV_PM_OPS(spear_smi_pm_ops, spear_smi_suspend, spear_smi_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(spear_smi_pm_ops, spear_smi_suspend, spear_smi_resume);
#ifdef CONFIG_OF
static const struct of_device_id spear_smi_id_table[] = {
@@ -1090,7 +1088,7 @@ static struct platform_driver spear_smi_driver = {
.name = "smi",
.bus = &platform_bus_type,
.of_match_table = of_match_ptr(spear_smi_id_table),
- .pm = &spear_smi_pm_ops,
+ .pm = pm_sleep_ptr(&spear_smi_pm_ops),
},
.probe = spear_smi_probe,
.remove = spear_smi_remove,
--
2.47.3