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>
---
drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 ++--
.../net/ethernet/stmicro/stmmac/stmmac_pci.c | 36 ++-----------------
2 files changed, 6 insertions(+), 36 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
index d2bff28fe409..00df980fd4e0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
+++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
@@ -378,11 +378,8 @@ config DWMAC_LOONGSON
This selects the LOONGSON PCI bus support for the stmmac driver,
Support for ethernet controller on Loongson-2K1000 SoC and LS7A1000 bridge.
-endif
-
config STMMAC_PCI
tristate "STMMAC PCI bus support"
- depends on STMMAC_ETH && PCI
depends on COMMON_CLK
help
This selects the platform specific bus support for the stmmac driver.
@@ -392,4 +389,7 @@ config STMMAC_PCI
If you have a controller with this interface, say Y or M here.
If unsure, say N.
+
+endif
+
endif
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
index 94b3a3b27270..fa92be672c54 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
@@ -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);
@@ -139,37 +140,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
*
@@ -249,8 +219,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);
}
--
2.51.2
在 2025/11/11 18:11, Yao Zi 写道:
> 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: Yanteng Si <siyanteng@cqsoftware.com.cn>
Thanks,
Yanteng
> ---
> drivers/net/ethernet/stmicro/stmmac/Kconfig | 6 ++--
> .../net/ethernet/stmicro/stmmac/stmmac_pci.c | 36 ++-----------------
> 2 files changed, 6 insertions(+), 36 deletions(-)
>
> diff --git a/drivers/net/ethernet/stmicro/stmmac/Kconfig b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> index d2bff28fe409..00df980fd4e0 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/Kconfig
> +++ b/drivers/net/ethernet/stmicro/stmmac/Kconfig
> @@ -378,11 +378,8 @@ config DWMAC_LOONGSON
> This selects the LOONGSON PCI bus support for the stmmac driver,
> Support for ethernet controller on Loongson-2K1000 SoC and LS7A1000 bridge.
>
> -endif
> -
> config STMMAC_PCI
> tristate "STMMAC PCI bus support"
> - depends on STMMAC_ETH && PCI
> depends on COMMON_CLK
> help
> This selects the platform specific bus support for the stmmac driver.
> @@ -392,4 +389,7 @@ config STMMAC_PCI
> If you have a controller with this interface, say Y or M here.
>
> If unsure, say N.
> +
> +endif
> +
> endif
> diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> index 94b3a3b27270..fa92be672c54 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c
> @@ -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);
> @@ -139,37 +140,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
> *
> @@ -249,8 +219,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);
> }
On Tue, Nov 11, 2025 at 10:11:58AM +0000, Yao Zi wrote: > 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> Thanks! -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
© 2016 - 2026 Red Hat, Inc.