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 - 15:02:40 EST
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?
Reviewed-by: Andrew Lunn <andrew@xxxxxxx>
Andrew