[PATCH 07/12] mtd: rawnand: fsmc: Remove #ifdef guards for PM related functions
Paul Cercueil
paul.cercueil at bootlin.com
Thu Nov 5 09:11:53 PST 2026
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 at bootlin.com>
---
drivers/mtd/nand/raw/fsmc_nand.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
index 837c23c63aeb..56ab42ee9e7d 100644
--- a/drivers/mtd/nand/raw/fsmc_nand.c
+++ b/drivers/mtd/nand/raw/fsmc_nand.c
@@ -1186,7 +1186,6 @@ static void fsmc_nand_remove(struct platform_device *pdev)
}
}
-#ifdef CONFIG_PM_SLEEP
static int fsmc_nand_suspend(struct device *dev)
{
struct fsmc_nand_data *host = dev_get_drvdata(dev);
@@ -1215,9 +1214,8 @@ static int fsmc_nand_resume(struct device *dev)
return 0;
}
-#endif
-static SIMPLE_DEV_PM_OPS(fsmc_nand_pm_ops, fsmc_nand_suspend, fsmc_nand_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(fsmc_nand_pm_ops, fsmc_nand_suspend, fsmc_nand_resume);
static const struct of_device_id fsmc_nand_id_table[] = {
{ .compatible = "st,spear600-fsmc-nand" },
@@ -1231,7 +1229,7 @@ static struct platform_driver fsmc_nand_driver = {
.driver = {
.name = "fsmc-nand",
.of_match_table = fsmc_nand_id_table,
- .pm = &fsmc_nand_pm_ops,
+ .pm = pm_sleep_ptr(&fsmc_nand_pm_ops),
},
};
--
2.47.3
More information about the linux-mtd
mailing list