* [PATCH 00/12] mtd: Remove #ifdef guards for PM related
@ 2026-11-05 17:11 Paul Cercueil
2026-11-05 17:11 ` [PATCH 01/12] mtd: Remove #ifdef guards for PM related functions Paul Cercueil
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil,
Stefan Agner, Matthias Brugger, AngeloGioacchino Del Regno,
linux-arm-kernel, linux-mediatek, Maxim Levitsky
Hi,
This patchset updates the MTD core / NAND core as well as several driver
to get rid of the #ifdef CONFIG_PM guards.
Instead, the code that depends on PM or runtime PM will be
garbage-collected by the compiler automatically if this config option is
not set.
The rationale behind this change is that in general conditionally
compiled code is a bad choice, as code behind a rarely-used config can
get broken without anybody noticing.
Cheers,
-Paul
Paul Cercueil (12):
mtd: Remove #ifdef guards for PM related functions
mtd: rawnand: vf610: Remove #ifdef guards for PM related functions
mtd: spear_smi: Remove #ifdef guards for PM related functions
mtd: physmap: Remove #ifdef guards for PM related functions
mtd: maps: pxa2xx: Remove #ifdef guards for PM related functions
mtd: nand: mtk: Remove #ifdef guards for PM related functions
mtd: rawnand: fsmc: Remove #ifdef guards for PM related functions
mtd: rawnand: hisi504: Remove #ifdef guards for PM related functions
mtd: rawnand: mtk: Remove #ifdef guards for PM related functions
mtd: rawnand: omap_elm: Remove #ifdef guards for PM related functions
mtd: rawnand: r852: Remove #ifdef guards for PM related functions
mtd: rawnand: txx9ndfmc: Remove #ifdef guards for PM related functions
drivers/mtd/devices/spear_smi.c | 6 ++----
drivers/mtd/maps/physmap-core.c | 6 +-----
drivers/mtd/maps/pxa2xx-flash.c | 6 +-----
drivers/mtd/mtdcore.c | 10 ++--------
drivers/mtd/nand/ecc-mtk.c | 8 ++------
drivers/mtd/nand/raw/fsmc_nand.c | 6 ++----
drivers/mtd/nand/raw/hisi504_nand.c | 7 +++----
drivers/mtd/nand/raw/mtk_nand.c | 8 ++------
drivers/mtd/nand/raw/omap_elm.c | 6 ++----
drivers/mtd/nand/raw/r852.c | 6 ++----
drivers/mtd/nand/raw/txx9ndfmc.c | 6 +-----
drivers/mtd/nand/raw/vf610_nfc.c | 6 ++----
12 files changed, 22 insertions(+), 59 deletions(-)
Cc: Stefan Agner <stefan@agner.ch>
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 01/12] mtd: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 02/12] mtd: rawnand: vf610: " Paul Cercueil
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil
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@bootlin.com>
---
drivers/mtd/mtdcore.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index 82b1e6392b16..037fe292867b 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -40,8 +40,6 @@
struct backing_dev_info *mtd_bdi;
-#ifdef CONFIG_PM_SLEEP
-
static int mtd_cls_suspend(struct device *dev)
{
struct mtd_info *mtd = dev_get_drvdata(dev);
@@ -58,15 +56,11 @@ static int mtd_cls_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(mtd_cls_pm_ops, mtd_cls_suspend, mtd_cls_resume);
-#define MTD_CLS_PM_OPS (&mtd_cls_pm_ops)
-#else
-#define MTD_CLS_PM_OPS NULL
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(mtd_cls_pm_ops, mtd_cls_suspend, mtd_cls_resume);
static struct class mtd_class = {
.name = "mtd",
- .pm = MTD_CLS_PM_OPS,
+ .pm = pm_sleep_ptr(&mtd_cls_pm_ops),
};
static DEFINE_IDR(mtd_idr);
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 02/12] mtd: rawnand: vf610: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
2026-11-05 17:11 ` [PATCH 01/12] mtd: Remove #ifdef guards for PM related functions Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 03/12] mtd: spear_smi: " Paul Cercueil
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil, Stefan Agner
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@bootlin.com>
---
Cc: Stefan Agner <stefan@agner.ch>
drivers/mtd/nand/raw/vf610_nfc.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/vf610_nfc.c b/drivers/mtd/nand/raw/vf610_nfc.c
index 9940681810cf..d785c3d28e51 100644
--- a/drivers/mtd/nand/raw/vf610_nfc.c
+++ b/drivers/mtd/nand/raw/vf610_nfc.c
@@ -906,7 +906,6 @@ static void vf610_nfc_remove(struct platform_device *pdev)
nand_cleanup(chip);
}
-#ifdef CONFIG_PM_SLEEP
static int vf610_nfc_suspend(struct device *dev)
{
struct vf610_nfc *nfc = dev_get_drvdata(dev);
@@ -928,15 +927,14 @@ static int vf610_nfc_resume(struct device *dev)
vf610_nfc_init_controller(nfc);
return 0;
}
-#endif
-static SIMPLE_DEV_PM_OPS(vf610_nfc_pm_ops, vf610_nfc_suspend, vf610_nfc_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(vf610_nfc_pm_ops, vf610_nfc_suspend, vf610_nfc_resume);
static struct platform_driver vf610_nfc_driver = {
.driver = {
.name = DRV_NAME,
.of_match_table = vf610_nfc_dt_ids,
- .pm = &vf610_nfc_pm_ops,
+ .pm = pm_sleep_ptr(&vf610_nfc_pm_ops),
},
.probe = vf610_nfc_probe,
.remove = vf610_nfc_remove,
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 03/12] mtd: spear_smi: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
2026-11-05 17:11 ` [PATCH 01/12] mtd: Remove #ifdef guards for PM related functions Paul Cercueil
2026-11-05 17:11 ` [PATCH 02/12] mtd: rawnand: vf610: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 04/12] mtd: physmap: " Paul Cercueil
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil
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@bootlin.com>
---
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
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 04/12] mtd: physmap: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
` (2 preceding siblings ...)
2026-11-05 17:11 ` [PATCH 03/12] mtd: spear_smi: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 05/12] mtd: maps: pxa2xx: " Paul Cercueil
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil
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@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
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 05/12] mtd: maps: pxa2xx: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
` (3 preceding siblings ...)
2026-11-05 17:11 ` [PATCH 04/12] mtd: physmap: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 06/12] mtd: nand: mtk: " Paul Cercueil
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil
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@bootlin.com>
---
drivers/mtd/maps/pxa2xx-flash.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/mtd/maps/pxa2xx-flash.c b/drivers/mtd/maps/pxa2xx-flash.c
index bc303a9909d4..15f7fa3548cb 100644
--- a/drivers/mtd/maps/pxa2xx-flash.c
+++ b/drivers/mtd/maps/pxa2xx-flash.c
@@ -111,7 +111,6 @@ static void pxa2xx_flash_remove(struct platform_device *dev)
kfree(info);
}
-#ifdef CONFIG_PM
static void pxa2xx_flash_shutdown(struct platform_device *dev)
{
struct pxa2xx_flash_info *info = platform_get_drvdata(dev);
@@ -119,9 +118,6 @@ static void pxa2xx_flash_shutdown(struct platform_device *dev)
if (info && mtd_suspend(info->mtd) == 0)
mtd_resume(info->mtd);
}
-#else
-#define pxa2xx_flash_shutdown NULL
-#endif
static struct platform_driver pxa2xx_flash_driver = {
.driver = {
@@ -129,7 +125,7 @@ static struct platform_driver pxa2xx_flash_driver = {
},
.probe = pxa2xx_flash_probe,
.remove = pxa2xx_flash_remove,
- .shutdown = pxa2xx_flash_shutdown,
+ .shutdown = pm_ptr(pxa2xx_flash_shutdown),
};
module_platform_driver(pxa2xx_flash_driver);
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 06/12] mtd: nand: mtk: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
` (4 preceding siblings ...)
2026-11-05 17:11 ` [PATCH 05/12] mtd: maps: pxa2xx: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 07/12] mtd: rawnand: fsmc: " Paul Cercueil
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil,
Matthias Brugger, AngeloGioacchino Del Regno, linux-arm-kernel,
linux-mediatek
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@bootlin.com>
---
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@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
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 07/12] mtd: rawnand: fsmc: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
` (5 preceding siblings ...)
2026-11-05 17:11 ` [PATCH 06/12] mtd: nand: mtk: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 08/12] mtd: rawnand: hisi504: " Paul Cercueil
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil
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@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
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 08/12] mtd: rawnand: hisi504: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
` (6 preceding siblings ...)
2026-11-05 17:11 ` [PATCH 07/12] mtd: rawnand: fsmc: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 09/12] mtd: rawnand: mtk: " Paul Cercueil
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil
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@bootlin.com>
---
drivers/mtd/nand/raw/hisi504_nand.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/hisi504_nand.c b/drivers/mtd/nand/raw/hisi504_nand.c
index d97270ec1185..511d133ea936 100644
--- a/drivers/mtd/nand/raw/hisi504_nand.c
+++ b/drivers/mtd/nand/raw/hisi504_nand.c
@@ -809,7 +809,6 @@ static void hisi_nfc_remove(struct platform_device *pdev)
nand_cleanup(chip);
}
-#ifdef CONFIG_PM_SLEEP
static int hisi_nfc_suspend(struct device *dev)
{
struct hinfc_host *host = dev_get_drvdata(dev);
@@ -842,8 +841,8 @@ static int hisi_nfc_resume(struct device *dev)
return 0;
}
-#endif
-static SIMPLE_DEV_PM_OPS(hisi_nfc_pm_ops, hisi_nfc_suspend, hisi_nfc_resume);
+
+static DEFINE_SIMPLE_DEV_PM_OPS(hisi_nfc_pm_ops, hisi_nfc_suspend, hisi_nfc_resume);
static const struct of_device_id nfc_id_table[] = {
{ .compatible = "hisilicon,504-nfc" },
@@ -855,7 +854,7 @@ static struct platform_driver hisi_nfc_driver = {
.driver = {
.name = "hisi_nand",
.of_match_table = nfc_id_table,
- .pm = &hisi_nfc_pm_ops,
+ .pm = pm_sleep_ptr(&hisi_nfc_pm_ops),
},
.probe = hisi_nfc_probe,
.remove = hisi_nfc_remove,
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 09/12] mtd: rawnand: mtk: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
` (7 preceding siblings ...)
2026-11-05 17:11 ` [PATCH 08/12] mtd: rawnand: hisi504: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 10/12] mtd: rawnand: omap_elm: " Paul Cercueil
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil,
Matthias Brugger, AngeloGioacchino Del Regno, linux-arm-kernel,
linux-mediatek
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@bootlin.com>
---
Cc: Matthias Brugger <matthias.bgg@gmail.com>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-mediatek@lists.infradead.org
drivers/mtd/nand/raw/mtk_nand.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/mtd/nand/raw/mtk_nand.c b/drivers/mtd/nand/raw/mtk_nand.c
index c439b7814ebb..4b8451772f9b 100644
--- a/drivers/mtd/nand/raw/mtk_nand.c
+++ b/drivers/mtd/nand/raw/mtk_nand.c
@@ -1591,7 +1591,6 @@ static void mtk_nfc_remove(struct platform_device *pdev)
mtk_ecc_release(nfc->ecc);
}
-#ifdef CONFIG_PM_SLEEP
static int mtk_nfc_suspend(struct device *dev)
{
struct mtk_nfc *nfc = dev_get_drvdata(dev);
@@ -1635,8 +1634,7 @@ static int mtk_nfc_resume(struct device *dev)
return 0;
}
-static SIMPLE_DEV_PM_OPS(mtk_nfc_pm_ops, mtk_nfc_suspend, mtk_nfc_resume);
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(mtk_nfc_pm_ops, mtk_nfc_suspend, mtk_nfc_resume);
static struct platform_driver mtk_nfc_driver = {
.probe = mtk_nfc_probe,
@@ -1644,9 +1642,7 @@ static struct platform_driver mtk_nfc_driver = {
.driver = {
.name = MTK_NAME,
.of_match_table = mtk_nfc_id_table,
-#ifdef CONFIG_PM_SLEEP
- .pm = &mtk_nfc_pm_ops,
-#endif
+ .pm = pm_sleep_ptr(&mtk_nfc_pm_ops),
},
};
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 10/12] mtd: rawnand: omap_elm: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
` (8 preceding siblings ...)
2026-11-05 17:11 ` [PATCH 09/12] mtd: rawnand: mtk: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 11/12] mtd: rawnand: r852: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 12/12] mtd: rawnand: txx9ndfmc: " Paul Cercueil
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil
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@bootlin.com>
---
drivers/mtd/nand/raw/omap_elm.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/omap_elm.c b/drivers/mtd/nand/raw/omap_elm.c
index c1d19b8e6715..2e8ab20d8edb 100644
--- a/drivers/mtd/nand/raw/omap_elm.c
+++ b/drivers/mtd/nand/raw/omap_elm.c
@@ -428,7 +428,6 @@ static void elm_remove(struct platform_device *pdev)
pm_runtime_disable(&pdev->dev);
}
-#ifdef CONFIG_PM_SLEEP
/*
* elm_context_save
* saves ELM configurations to preserve them across Hardware powered-down
@@ -540,9 +539,8 @@ static int elm_resume(struct device *dev)
elm_context_restore(info);
return 0;
}
-#endif
-static SIMPLE_DEV_PM_OPS(elm_pm_ops, elm_suspend, elm_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(elm_pm_ops, elm_suspend, elm_resume);
#ifdef CONFIG_OF
static const struct of_device_id elm_of_match[] = {
@@ -557,7 +555,7 @@ static struct platform_driver elm_driver = {
.driver = {
.name = DRIVER_NAME,
.of_match_table = of_match_ptr(elm_of_match),
- .pm = &elm_pm_ops,
+ .pm = pm_sleep_ptr(&elm_pm_ops),
},
.probe = elm_probe,
.remove = elm_remove,
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 11/12] mtd: rawnand: r852: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
` (9 preceding siblings ...)
2026-11-05 17:11 ` [PATCH 10/12] mtd: rawnand: omap_elm: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
2026-11-05 17:11 ` [PATCH 12/12] mtd: rawnand: txx9ndfmc: " Paul Cercueil
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil, Maxim Levitsky
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@bootlin.com>
---
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
drivers/mtd/nand/raw/r852.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/nand/raw/r852.c b/drivers/mtd/nand/raw/r852.c
index 92c47d351c27..c145eb8ac29d 100644
--- a/drivers/mtd/nand/raw/r852.c
+++ b/drivers/mtd/nand/raw/r852.c
@@ -1013,7 +1013,6 @@ static void r852_shutdown(struct pci_dev *pci_dev)
pci_disable_device(pci_dev);
}
-#ifdef CONFIG_PM_SLEEP
static int r852_suspend(struct device *device)
{
struct r852_device *dev = dev_get_drvdata(device);
@@ -1066,7 +1065,6 @@ static int r852_resume(struct device *device)
r852_update_card_detect(dev);
return 0;
}
-#endif
static const struct pci_device_id r852_pci_id_tbl[] = {
@@ -1076,7 +1074,7 @@ static const struct pci_device_id r852_pci_id_tbl[] = {
MODULE_DEVICE_TABLE(pci, r852_pci_id_tbl);
-static SIMPLE_DEV_PM_OPS(r852_pm_ops, r852_suspend, r852_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(r852_pm_ops, r852_suspend, r852_resume);
static struct pci_driver r852_pci_driver = {
.name = DRV_NAME,
@@ -1084,7 +1082,7 @@ static struct pci_driver r852_pci_driver = {
.probe = r852_probe,
.remove = r852_remove,
.shutdown = r852_shutdown,
- .driver.pm = &r852_pm_ops,
+ .driver.pm = pm_sleep_ptr(&r852_pm_ops),
};
module_pci_driver(r852_pci_driver);
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 12/12] mtd: rawnand: txx9ndfmc: Remove #ifdef guards for PM related functions
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
` (10 preceding siblings ...)
2026-11-05 17:11 ` [PATCH 11/12] mtd: rawnand: r852: " Paul Cercueil
@ 2026-11-05 17:11 ` Paul Cercueil
11 siblings, 0 replies; 13+ messages in thread
From: Paul Cercueil @ 2026-11-05 17:11 UTC (permalink / raw)
To: Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, Thomas Petazzoni, Paul Cercueil
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@bootlin.com>
---
drivers/mtd/nand/raw/txx9ndfmc.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/drivers/mtd/nand/raw/txx9ndfmc.c b/drivers/mtd/nand/raw/txx9ndfmc.c
index 4cc6e91dbc23..9dc624957a3c 100644
--- a/drivers/mtd/nand/raw/txx9ndfmc.c
+++ b/drivers/mtd/nand/raw/txx9ndfmc.c
@@ -391,21 +391,17 @@ static void txx9ndfmc_remove(struct platform_device *dev)
}
}
-#ifdef CONFIG_PM
static int txx9ndfmc_resume(struct platform_device *dev)
{
if (platform_get_drvdata(dev))
txx9ndfmc_initialize(dev);
return 0;
}
-#else
-#define txx9ndfmc_resume NULL
-#endif
static struct platform_driver txx9ndfmc_driver = {
.probe = txx9ndfmc_probe,
.remove = txx9ndfmc_remove,
- .resume = txx9ndfmc_resume,
+ .resume = pm_ptr(txx9ndfmc_resume),
.driver = {
.name = "txx9ndfmc",
},
--
2.47.3
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2026-11-05 17:13 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 17:11 [PATCH 00/12] mtd: Remove #ifdef guards for PM related Paul Cercueil
2026-11-05 17:11 ` [PATCH 01/12] mtd: Remove #ifdef guards for PM related functions Paul Cercueil
2026-11-05 17:11 ` [PATCH 02/12] mtd: rawnand: vf610: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 03/12] mtd: spear_smi: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 04/12] mtd: physmap: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 05/12] mtd: maps: pxa2xx: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 06/12] mtd: nand: mtk: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 07/12] mtd: rawnand: fsmc: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 08/12] mtd: rawnand: hisi504: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 09/12] mtd: rawnand: mtk: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 10/12] mtd: rawnand: omap_elm: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 11/12] mtd: rawnand: r852: " Paul Cercueil
2026-11-05 17:11 ` [PATCH 12/12] mtd: rawnand: txx9ndfmc: " Paul Cercueil
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®