]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: stmmac: pci: Use generic PCI suspend/resume routines
authorYao Zi <ziyao@disroot.org>
Mon, 24 Nov 2025 16:04:17 +0000 (16:04 +0000)
committerJakub Kicinski <kuba@kernel.org>
Thu, 27 Nov 2025 01:07:42 +0000 (17:07 -0800)
Convert STMMAC PCI glue driver to use the generic platform
suspend/resume routines for PCI controllers, instead of implementing its
own one.

Signed-off-by: Yao Zi <ziyao@disroot.org>
Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Yanteng Si <siyanteng@cqsoftware.com.cn>
Link: https://patch.msgid.link/20251124160417.51514-4-ziyao@disroot.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/stmicro/stmmac/Kconfig
drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c

index ad7ae3618099602efac5979cdbb2ed4cf1807378..907fe2e927f015542b6a7228eae9a6c6945be3ac 100644 (file)
@@ -376,8 +376,9 @@ config DWMAC_LOONGSON
 
 config STMMAC_PCI
        tristate "STMMAC PCI bus support"
-       depends on STMMAC_ETH && PCI
+       depends on PCI
        depends on COMMON_CLK
+       select STMMAC_LIBPCI
        help
          This selects the platform specific bus support for the stmmac driver.
          This driver was tested on XLINX XC2V3000 FF1152AMT0221
index afb1c53ca6f87b23f96ec89cd98cb12402ffb278..270ad066ced31f97c3d0d3a41440dfa75ed02578 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/dmi.h>
 
 #include "stmmac.h"
+#include "stmmac_libpci.h"
 
 struct stmmac_pci_info {
        int (*setup)(struct pci_dev *pdev, struct plat_stmmacenet_data *plat);
@@ -102,37 +103,6 @@ static const struct stmmac_pci_info snps_gmac5_pci_info = {
        .setup = snps_gmac5_default_data,
 };
 
-static int stmmac_pci_suspend(struct device *dev, void *bsp_priv)
-{
-       struct pci_dev *pdev = to_pci_dev(dev);
-       int ret;
-
-       ret = pci_save_state(pdev);
-       if (ret)
-               return ret;
-
-       pci_disable_device(pdev);
-       pci_wake_from_d3(pdev, true);
-       return 0;
-}
-
-static int stmmac_pci_resume(struct device *dev, void *bsp_priv)
-{
-       struct pci_dev *pdev = to_pci_dev(dev);
-       int ret;
-
-       pci_restore_state(pdev);
-       pci_set_power_state(pdev, PCI_D0);
-
-       ret = pci_enable_device(pdev);
-       if (ret)
-               return ret;
-
-       pci_set_master(pdev);
-
-       return 0;
-}
-
 /**
  * stmmac_pci_probe
  *
@@ -212,8 +182,8 @@ static int stmmac_pci_probe(struct pci_dev *pdev,
        plat->safety_feat_cfg->prtyen = 1;
        plat->safety_feat_cfg->tmouten = 1;
 
-       plat->suspend = stmmac_pci_suspend;
-       plat->resume = stmmac_pci_resume;
+       plat->suspend = stmmac_pci_plat_suspend;
+       plat->resume = stmmac_pci_plat_resume;
 
        return stmmac_dvr_probe(&pdev->dev, plat, &res);
 }