mmc: wmt-sdmmc: use modern PM macros
authorJisheng Zhang <jszhang@kernel.org>
Fri, 15 Aug 2025 01:34:06 +0000 (09:34 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Fri, 22 Aug 2025 10:14:04 +0000 (12:14 +0200)
Use the modern 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: Jisheng Zhang <jszhang@kernel.org>
Link: https://lore.kernel.org/r/20250815013413.28641-32-jszhang@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/wmt-sdmmc.c

index 0d2929c..1b1d691 100644 (file)
@@ -911,7 +911,6 @@ static void wmt_mci_remove(struct platform_device *pdev)
        dev_info(&pdev->dev, "WMT MCI device removed\n");
 }
 
-#ifdef CONFIG_PM
 static int wmt_mci_suspend(struct device *dev)
 {
        u32 reg_tmp;
@@ -963,18 +962,7 @@ static int wmt_mci_resume(struct device *dev)
        return 0;
 }
 
-static const struct dev_pm_ops wmt_mci_pm = {
-       .suspend        = wmt_mci_suspend,
-       .resume         = wmt_mci_resume,
-};
-
-#define wmt_mci_pm_ops (&wmt_mci_pm)
-
-#else  /* !CONFIG_PM */
-
-#define wmt_mci_pm_ops NULL
-
-#endif
+static DEFINE_SIMPLE_DEV_PM_OPS(wmt_mci_pm_ops, wmt_mci_suspend, wmt_mci_resume);
 
 static struct platform_driver wmt_mci_driver = {
        .probe = wmt_mci_probe,
@@ -982,7 +970,7 @@ static struct platform_driver wmt_mci_driver = {
        .driver = {
                .name = DRIVER_NAME,
                .probe_type = PROBE_PREFER_ASYNCHRONOUS,
-               .pm = wmt_mci_pm_ops,
+               .pm = pm_sleep_ptr(&wmt_mci_pm_ops),
                .of_match_table = wmt_mci_dt_ids,
        },
 };