[PATCH 11/12] mtd: rawnand: r852: Remove #ifdef guards for PM related functions

From: Paul Cercueil

Date: Thu Nov 05 2026 - 12:20:20 EST


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@xxxxxxxxxxx>
---
Cc: Maxim Levitsky <maximlevitsky@xxxxxxxxx>

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