]> www.infradead.org Git - users/hch/misc.git/commitdiff
mmc: sdhci-of-esdhc: use modern PM macros
authorJisheng Zhang <jszhang@kernel.org>
Fri, 15 Aug 2025 01:33:56 +0000 (09:33 +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-22-jszhang@kernel.org
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-of-esdhc.c

index c6ee0099ead0966f4d805bbe027965aa273b3c1c..8345e2c5a034139c7f4e8e60c4faedde6665a9c5 100644 (file)
@@ -1234,7 +1234,6 @@ static u32 esdhc_irq(struct sdhci_host *host, u32 intmask)
        return intmask;
 }
 
-#ifdef CONFIG_PM_SLEEP
 static u32 esdhc_proctl;
 static int esdhc_of_suspend(struct device *dev)
 {
@@ -1260,11 +1259,8 @@ static int esdhc_of_resume(struct device *dev)
        }
        return ret;
 }
-#endif
 
-static SIMPLE_DEV_PM_OPS(esdhc_of_dev_pm_ops,
-                       esdhc_of_suspend,
-                       esdhc_of_resume);
+static DEFINE_SIMPLE_DEV_PM_OPS(esdhc_of_dev_pm_ops, esdhc_of_suspend, esdhc_of_resume);
 
 static const struct sdhci_ops sdhci_esdhc_be_ops = {
        .read_l = esdhc_be_readl,
@@ -1511,7 +1507,7 @@ static struct platform_driver sdhci_esdhc_driver = {
                .name = "sdhci-esdhc",
                .probe_type = PROBE_PREFER_ASYNCHRONOUS,
                .of_match_table = sdhci_esdhc_of_match,
-               .pm = &esdhc_of_dev_pm_ops,
+               .pm = pm_sleep_ptr(&esdhc_of_dev_pm_ops),
        },
        .probe = sdhci_esdhc_probe,
        .remove = sdhci_pltfm_remove,