[PATCH net-next v2 0/3] Unify platform suspend/resume routines for PCI DWMAC glue

Yao Zi posted 3 patches 1 month, 2 weeks ago
There is a newer version of this series
drivers/net/ethernet/stmicro/stmmac/Kconfig   | 11 +++++
drivers/net/ethernet/stmicro/stmmac/Makefile  |  1 +
.../ethernet/stmicro/stmmac/dwmac-loongson.c  | 36 ++------------
.../ethernet/stmicro/stmmac/stmmac_libpci.c   | 48 +++++++++++++++++++
.../ethernet/stmicro/stmmac/stmmac_libpci.h   | 12 +++++
.../net/ethernet/stmicro/stmmac/stmmac_pci.c  | 36 ++------------
6 files changed, 78 insertions(+), 66 deletions(-)
create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_libpci.c
create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_libpci.h
[PATCH net-next v2 0/3] Unify platform suspend/resume routines for PCI DWMAC glue
Posted by Yao Zi 1 month, 2 weeks ago
There are currently three PCI-based DWMAC glue drivers in tree,
stmmac_pci.c, dwmac-intel.c, and dwmac-loongson.c. Both stmmac_pci.c and
dwmac-intel.c implements the same and duplicated platform suspend/resume
routines.

This series introduces a new PCI helper library, stmmac_libpci.c,
providing a pair of helpers, stmmac_pci_plat_{suspend,resume}, and
replaces the driver-specific implementation with the helpers to reduce
code duplication. The helper will also simplify the Motorcomm DWMAC glue
driver which I'm working on.

The glue driver for Intel controllers isn't covered by the series, since
its suspend routine doesn't call pci_disable_device() and thus is a
little different from the new generic helpers.

I only have Loongson hardware on hand, thus the series is only tested on
Loongson 3A5000 machine. I could confirm the controller works after
resume, and WoL works as expected. This shouldn't break stmmac_pci.c,
either, since the new helpers have the exactly same code as the old
driver-specific suspend/resume hooks.

Changed from v1
- Separate the new suspend/resume helpers into a new file,
  stmmac_libpci.c, and provide Kconfig symbol for it
- Link to v1: https://lore.kernel.org/netdev/20251028154332.59118-1-ziyao@disroot.org/

Yao Zi (3):
  net: stmmac: Add generic suspend/resume helper for PCI-based
    controllers
  net: stmmac: loongson: Use generic PCI suspend/resume routines
  net: stmmac: pci: Use generic PCI suspend/resume routines

 drivers/net/ethernet/stmicro/stmmac/Kconfig   | 11 +++++
 drivers/net/ethernet/stmicro/stmmac/Makefile  |  1 +
 .../ethernet/stmicro/stmmac/dwmac-loongson.c  | 36 ++------------
 .../ethernet/stmicro/stmmac/stmmac_libpci.c   | 48 +++++++++++++++++++
 .../ethernet/stmicro/stmmac/stmmac_libpci.h   | 12 +++++
 .../net/ethernet/stmicro/stmmac/stmmac_pci.c  | 36 ++------------
 6 files changed, 78 insertions(+), 66 deletions(-)
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_libpci.c
 create mode 100644 drivers/net/ethernet/stmicro/stmmac/stmmac_libpci.h

-- 
2.51.2