]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mmc: dw_mmc-pltfm: use modern PM macros
authorShawn Lin <shawn.lin@rock-chips.com>
Tue, 6 Jan 2026 02:17:08 +0000 (10:17 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 23 Feb 2026 11:06:54 +0000 (12:06 +0100)
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.

When this's done, remove all variant drivers' local pm definition and
replace it with dw_mci_pltfm_pmops.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
[Ulf: Fixed conflict by dropping changes for dw_mmc-rockchip]
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/dw_mmc-bluefield.c
drivers/mmc/host/dw_mmc-k3.c
drivers/mmc/host/dw_mmc-pci.c
drivers/mmc/host/dw_mmc-pltfm.c
drivers/mmc/host/dw_mmc.c
drivers/mmc/host/dw_mmc.h

index 3cf526ab0387bdabe9e67ae3028ca463b582a7c2..ed6dea42b18e8efc2ebdc72274d84d3482a45d33 100644 (file)
@@ -73,7 +73,7 @@ static struct platform_driver dw_mci_bluefield_pltfm_driver = {
                .name           = "dwmmc_bluefield",
                .probe_type     = PROBE_PREFER_ASYNCHRONOUS,
                .of_match_table = dw_mci_bluefield_match,
-               .pm             = &dw_mci_pltfm_pmops,
+               .pm             = pm_ptr(&dw_mci_pltfm_pmops),
        },
 };
 
index 23c303106dcab93400b85a0da91f9a1967e60a22..8cf0487b952c7cd4070a93f2b8be8b3a2cf10c56 100644 (file)
@@ -455,11 +455,6 @@ static int dw_mci_k3_probe(struct platform_device *pdev)
        return dw_mci_pltfm_register(pdev, drv_data);
 }
 
-static const struct dev_pm_ops dw_mci_k3_dev_pm_ops = {
-       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
-       RUNTIME_PM_OPS(dw_mci_runtime_suspend, dw_mci_runtime_resume, NULL)
-};
-
 static struct platform_driver dw_mci_k3_pltfm_driver = {
        .probe          = dw_mci_k3_probe,
        .remove         = dw_mci_pltfm_remove,
@@ -467,7 +462,7 @@ static struct platform_driver dw_mci_k3_pltfm_driver = {
                .name           = "dwmmc_k3",
                .probe_type     = PROBE_PREFER_ASYNCHRONOUS,
                .of_match_table = dw_mci_k3_match,
-               .pm             = pm_ptr(&dw_mci_k3_dev_pm_ops),
+               .pm             = pm_ptr(&dw_mci_pltfm_pmops),
        },
 };
 
index 66d2edc30600919746b978f720f8c8118ed3930e..e046674c974899d9c66ea77003fcc9d93f3b3ebe 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/mmc/host.h>
 #include <linux/mmc/mmc.h>
 #include "dw_mmc.h"
+#include "dw_mmc-pltfm.h"
 
 #define SYNOPSYS_DW_MCI_VENDOR_ID 0x700
 #define SYNOPSYS_DW_MCI_DEVICE_ID 0x1107
@@ -71,11 +72,6 @@ static void dw_mci_pci_remove(struct pci_dev *pdev)
        dw_mci_remove(host);
 }
 
-static const struct dev_pm_ops dw_mci_pci_dev_pm_ops = {
-       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
-       RUNTIME_PM_OPS(dw_mci_runtime_suspend, dw_mci_runtime_resume, NULL)
-};
-
 static const struct pci_device_id dw_mci_pci_id[] = {
        { PCI_DEVICE(SYNOPSYS_DW_MCI_VENDOR_ID, SYNOPSYS_DW_MCI_DEVICE_ID) },
        {}
@@ -88,7 +84,7 @@ static struct pci_driver dw_mci_pci_driver = {
        .probe          = dw_mci_pci_probe,
        .remove         = dw_mci_pci_remove,
        .driver         =       {
-               .pm =   pm_ptr(&dw_mci_pci_dev_pm_ops),
+               .pm =   pm_ptr(&dw_mci_pltfm_pmops),
        },
 };
 
index c7d72735059626656f922d764df787fdd123282d..fde465a4bf5db14d017b6d4ec0bbd44956dee6c9 100644 (file)
@@ -57,9 +57,9 @@ int dw_mci_pltfm_register(struct platform_device *pdev,
 EXPORT_SYMBOL_GPL(dw_mci_pltfm_register);
 
 const struct dev_pm_ops dw_mci_pltfm_pmops = {
-       SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+       SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
                                pm_runtime_force_resume)
-       SET_RUNTIME_PM_OPS(dw_mci_runtime_suspend,
+       RUNTIME_PM_OPS(dw_mci_runtime_suspend,
                           dw_mci_runtime_resume,
                           NULL)
 };
index 1d085b41920eda2f5c730625aa4e98f7ade69c83..d7c5b13e48f90827641a599b909e464e5bc772fa 100644 (file)
@@ -3440,7 +3440,6 @@ void dw_mci_remove(struct dw_mci *host)
 }
 EXPORT_SYMBOL(dw_mci_remove);
 
-#ifdef CONFIG_PM
 int dw_mci_runtime_suspend(struct device *dev)
 {
        struct dw_mci *host = dev_get_drvdata(dev);
@@ -3526,7 +3525,6 @@ err:
        return ret;
 }
 EXPORT_SYMBOL(dw_mci_runtime_resume);
-#endif /* CONFIG_PM */
 
 static int __init dw_mci_init(void)
 {
index a4d5f4fa9375c865a9296bad56826a12243caa70..9a27d778f362e84d5c4460ecce66c26817c25ae2 100644 (file)
@@ -497,13 +497,8 @@ static inline void mci_fifo_l_writeq(void __iomem *addr, u64 value)
 extern struct dw_mci *dw_mci_alloc_host(struct device *device);
 extern int dw_mci_probe(struct dw_mci *host);
 extern void dw_mci_remove(struct dw_mci *host);
-#ifdef CONFIG_PM
 extern int dw_mci_runtime_suspend(struct device *device);
 extern int dw_mci_runtime_resume(struct device *device);
-#else
-static inline int dw_mci_runtime_suspend(struct device *device) { return -EOPNOTSUPP; }
-static inline int dw_mci_runtime_resume(struct device *device) { return -EOPNOTSUPP; }
-#endif
 
 /**
  * dw_mci driver data - dw-mshc implementation specific driver data.