[PATCH v2 00/12] mtd: Remove #ifdef guards for PM functions

From: Paul Cercueil

Date: Tue Nov 17 2026 - 04:38:13 EST


Hi,

This is the v2 of my patchset that updates the MTD core / NAND core as
well as several drivers 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.

In this v2, I removed the pm_ptr() use on shutdown callbacks, as neither
platform_driver.shutdown() nor the mtd_suspend() / mtd_resume() that the
shutdown callbacks call are related to CONFIG_PM.

Changelog:

v2:
- [04/12]: Don't use pm_ptr(), and rewrite commit message
- [05/12]: Don't use pm_ptr(), and rewrite commit message

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 around shutdown callback
mtd: maps: pxa2xx: Remove #ifdef guards around shutdown callback
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 | 4 ----
drivers/mtd/maps/pxa2xx-flash.c | 4 ----
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, 20 insertions(+), 57 deletions(-)

Cc: Stefan Agner <stefan@xxxxxxxx>
Cc: Matthias Brugger <matthias.bgg@xxxxxxxxx>
Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Cc: linux-mediatek@xxxxxxxxxxxxxxxxxxx
Cc: Maxim Levitsky <maximlevitsky@xxxxxxxxx>

--
2.47.3