[PATCH 06/12] mtd: nand: mtk: Remove #ifdef guards for PM related functions
Paul Cercueil
paul.cercueil at bootlin.com
Thu Nov 5 09:11:52 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>
---
Cc: Matthias Brugger <matthias.bgg at gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
Cc: linux-arm-kernel at lists.infradead.org
Cc: linux-mediatek at lists.infradead.org
drivers/mtd/nand/ecc-mtk.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/nand/ecc-mtk.c b/drivers/mtd/nand/ecc-mtk.c
index 66f0985ef7cd..6f210ba935ad 100644
--- a/drivers/mtd/nand/ecc-mtk.c
+++ b/drivers/mtd/nand/ecc-mtk.c
@@ -588,7 +588,6 @@ static int mtk_ecc_probe(struct platform_device *pdev)
return 0;
}
-#ifdef CONFIG_PM_SLEEP
static int mtk_ecc_suspend(struct device *dev)
{
struct mtk_ecc *ecc = dev_get_drvdata(dev);
@@ -612,8 +611,7 @@ static int mtk_ecc_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(mtk_ecc_pm_ops, mtk_ecc_suspend, mtk_ecc_resume);
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(mtk_ecc_pm_ops, mtk_ecc_suspend, mtk_ecc_resume);
MODULE_DEVICE_TABLE(of, mtk_ecc_dt_match);
@@ -622,9 +620,7 @@ static struct platform_driver mtk_ecc_driver = {
.driver = {
.name = "mtk-ecc",
.of_match_table = mtk_ecc_dt_match,
-#ifdef CONFIG_PM_SLEEP
- .pm = &mtk_ecc_pm_ops,
-#endif
+ .pm = pm_sleep_ptr(&mtk_ecc_pm_ops),
},
};
--
2.47.3
More information about the linux-mtd
mailing list