[PATCH 04/12] mtd: physmap: Remove #ifdef guards for PM related functions
Paul Cercueil
paul.cercueil at bootlin.com
Thu Nov 5 09:11:50 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/maps/physmap-core.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/mtd/maps/physmap-core.c b/drivers/mtd/maps/physmap-core.c
index dcda7685fc99..afda90fc23ee 100644
--- a/drivers/mtd/maps/physmap-core.c
+++ b/drivers/mtd/maps/physmap-core.c
@@ -600,7 +600,6 @@ static int physmap_flash_probe(struct platform_device *dev)
return err;
}
-#ifdef CONFIG_PM
static void physmap_flash_shutdown(struct platform_device *dev)
{
struct physmap_flash_info *info = platform_get_drvdata(dev);
@@ -610,14 +609,11 @@ static void physmap_flash_shutdown(struct platform_device *dev)
if (mtd_suspend(info->mtds[i]) == 0)
mtd_resume(info->mtds[i]);
}
-#else
-#define physmap_flash_shutdown NULL
-#endif
static struct platform_driver physmap_flash_driver = {
.probe = physmap_flash_probe,
.remove = physmap_flash_remove,
- .shutdown = physmap_flash_shutdown,
+ .shutdown = pm_ptr(physmap_flash_shutdown),
.driver = {
.name = "physmap-flash",
.of_match_table = of_flash_match,
--
2.47.3
More information about the linux-mtd
mailing list