Re: [PATCH net-next v23 8/9] net: dsa: mt7530: generalize and move common function to lib module

From: Andrew Lunn

Date: Sun Sep 27 2026 - 17:49:11 EST


On Sun, Sep 27, 2026 at 10:28:25PM +0200, Christian Marangi wrote:
> On Sun, Sep 27, 2026 at 09:02:09PM +0200, Andrew Lunn wrote:
> > On Fri, Sep 25, 2026 at 08:24:30PM +0200, Christian Marangi wrote:
> > > In preparation of support of DSA Switch from Airoha, create a mt7530
> > > library module and move there all the common function.
> > >
> > > Function are generalized to use the reg_field regmap API but still apply
> > > the same exact logic. Every function is renamed to mt7530_lib prefix to
> > > better identify it.
> > >
> > > Minimum modification are needed to the register header and common enum and
> > > macro are moved to the mt7530 library header to permit reuse.
> > >
> > > A library struct is introduced with everything required for the common
> > > functions.
> > >
> > > The generalization and the introduction of reg_field regmap API have the
> > > side effect of permitting to clean the mirror functions that required
> > > special handling for MT7530 and MT7531 based switch that had different
> > > registers. This is done by declaring a common MT7530 reg_field and a
> > > specific one in the Switch match table.
> > >
> > > No behaviour change is expected by this change as it's just a code move and
> > > reimplementation.
> > >
> > > Signed-off-by: Christian Marangi <ansuelsmth@xxxxxxxxx>
> > > ---
> > > drivers/net/dsa/Kconfig | 4 +
> > > drivers/net/dsa/Makefile | 1 +
> > > drivers/net/dsa/mt7530-lib.c | 1128 +++++++++++++++++++++++++++
> > > drivers/net/dsa/mt7530-lib.h | 391 ++++++++++
> > > drivers/net/dsa/mt7530-mdio.c | 4 +
> > > drivers/net/dsa/mt7530-mmio.c | 4 +
> > > drivers/net/dsa/mt7530.c | 1368 ++++++++-------------------------
> > > drivers/net/dsa/mt7530.h | 256 ++----
> >
> > The number of mt* file keep going up. Is it time to move it into a
> > subdirectory?
>
> The problem as always is that mediatek directory will also contain airoha
> stuff...

That is only a Marketing problem, and Mainline generally ignores
marketing. Companies get bought and sold all the time. We don't rename
anything because of that.

> I would like to fix some trivial things pointed out by sashiko. Can I apply
> those and keep the review tag? For this patch for example it's just the
> typo for the multicast MIB.
>
> For the other patch is also very trivial stuff.

Yes, not a problem. If you make major changes then drop it, but
trivial stuff is fine.

Andrew