Re: [PATCH net-next 1/3] net: stmmac: Add generic suspend/resume helper for PCI-based controllers
From: Yao Zi
Date: Tue Oct 28 2025 - 22:51:11 EST
On Wed, Oct 29, 2025 at 10:27:18AM +0800, Yanteng Si wrote:
>
> 在 2025/10/28 下午11:59, Russell King (Oracle) 写道:
> > On Tue, Oct 28, 2025 at 03:43:30PM +0000, Yao Zi wrote:
> > > Most glue driver for PCI-based DWMAC controllers utilize similar
> > > platform suspend/resume routines. Add a generic implementation to reduce
> > > duplicated code.
> > >
> > > Signed-off-by: Yao Zi <ziyao@xxxxxxxxxxx>
> > > ---
> > > drivers/net/ethernet/stmicro/stmmac/stmmac.h | 2 +
> > > .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 +++++++++++++++++++
> > I would prefer not to make stmmac_main.c even larger by including bus
> > specific helpers there. We already have stmmac_pltfm.c for those which
> > use struct platform_device. The logical name would be stmmac_pci.c, but
> > that's already taken by a driver.
> >
> > One way around that would be to rename stmmac_pci.c to dwmac-pci.c
> > (glue drivers tend to be named dwmac-foo.c) and then re-use
> > stmmac_pci.c for PCI-related stuff in the same way that stmmac_pltfm.c
> > is used.
> >
> > Another idea would be stmmac_libpci.c.
>
> I also don't want stmmac_main.c to grow larger, and I prefer
>
> stmmac_libpci.c instead.
Okay, then I'll separate the code into stmmac_libpci.c instead. This
also avoids moving code around, making it easier to track git log in the
future.
> Another approach - maybe we can
>
> keep these helper functions in stmmac_pci.c and just declare
>
> them as extern where needed?
stmmac_pci.c is a standalone DWMAC glue driver, none of its symbols are
for external usage. I don't think it's appropriate to put these helpers
in the driver. Furthermore, this will also require PCI-based glues
making use of these helpers to depend on an unrelated driver,
introducing unnecessary code size, which doesn't sound like a good idea
to me.
I'd still like to introduce stmmac_libpci.c for these helpers.
> Thanks,
>
> Yanteng
>
> >
Best regards,
Yao Zi