[PATCH net-next 1/6] net: stmmac: add platform library

Serge Semin fancer.lancer at gmail.com
Thu Sep 14 03:42:19 PDT 2023


On Wed, Sep 13, 2023 at 03:21:10PM +0100, Russell King (Oracle) wrote:
> On Wed, Sep 13, 2023 at 03:14:47PM +0100, Russell King (Oracle) wrote:
> > On Wed, Sep 13, 2023 at 03:56:07AM +0300, Serge Semin wrote:
> > > On Tue, Sep 12, 2023 at 06:08:23PM +0100, Russell King (Oracle) wrote:
> > > > On Tue, Sep 12, 2023 at 12:32:40PM +0300, Serge Semin wrote:
> > > > > On Tue, Sep 12, 2023 at 07:59:49AM +0000, Jose Abreu wrote:
> > > > > > From: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
> > > > > > Date: Mon, Sep 11, 2023 at 16:28:40
> > > > > > 
> > > > > > > Add a platform library of helper functions for common traits in the
> > > > > > > platform drivers. Currently, this is setting the tx clock.
> > > > > > > 
> > > > > > > Signed-off-by: Russell King (Oracle) <rmk+kernel at armlinux.org.uk>
> > > > > > > ---
> > > > > 
> > > > > > >  drivers/net/ethernet/stmicro/stmmac/Makefile  |  2 +-
> > > > > > >  .../ethernet/stmicro/stmmac/stmmac_plat_lib.c | 29 +++++++++++++++++++
> > > > > > >  .../ethernet/stmicro/stmmac/stmmac_plat_lib.h |  8 +++++
> > > > > > 
> > > > > > Wouldn't it be better to just call it "stmmac_lib{.c,.h}" in case we need to add
> > > > > > more helpers on the future that are not only for platform-based drivers?
> > > > > 
> > > > > What is the difference between stmmac_platform.{c,h} and
> > > > > stmmac_plat_lib.{c,h} files? It isn't clear really. In perspective it
> > > > > may cause confusions like mixed definitions in both of these files.
> > > > > 
> > > > > Why not to use the stmmac_platform.{c,h} instead of adding one more
> > > > > file?
> > > > 
> > > 
> > > > Is stmmac_platform.{c,h} used by all the drivers that are making use of
> > > > this? I'm not entirely sure.
> > > > 
> > > > If it is, then yes, it can go in stmmac_platform.[ch]. If not, then I
> > > > don't think we'd want the bloat of forcing all of stmmac_platform.[ch]
> > > > onto drivers that only want to use this one function.
> > > 
> > > With a few exceptions almost all the STMMAC/DW*MAC glue drivers use
> > > the methods from the stmmac_platform.c module including the bits
> > > touched by your patchset. AFAICS semantically both stmmac_platform.c
> > > and stmmac_plat_lib.c look the same. They don't do anything on its own
> > > but provide some common methods utilized by the glue drivers for some
> > > platform-specific setups. So basically stmmac_platform.[ch] is already
> > > a library of the common platform methods. There is no need in creating
> > > another one.
> > 
> > I'm not questioning whether it should be merged, I'm questioning whether
> > all drivers that I'm touching make use of stmmac_platform.c, so your
> > long winded answer was entirely unnecessary. All you needed to do was
> > answer the question I asked, rather than teach me how to suck eggs.
> 

> So what about the name of the function? Are you happy that it's called
> "dwmac_set_tx_clk_gmii" rather than "stmmac_set_tx_clk_gmii" ?

Not really. I would suggest to preserve the local naming convention:
1. Generic names have stmmac_ prefix.
2. DW *MAC IP-core-specific names have dw(xg|xlg)?mac(100|1000|2|4|5)?_ prefixes.
Alas it was violated in some places (like norm_desc and enh_desc.c
files) but is still mainly preserved in the driver especially in the
stmmac_platform.c which is concerned in this case.

-Serge(y)

> 
> -- 
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-arm-kernel mailing list