Re: [PATCH 18/18] net: cpsw: fix mixed module-builtin object

From: Masahiro Yamada
Date: Wed Nov 23 2022 - 15:39:20 EST


On Sun, Nov 20, 2022 at 8:11 AM Alexander Lobakin <alobakin@xxxxx> wrote:
>
> Apart from cpdma, there are 4 object files shared in one way or
> another by 5 modules:
>
> > scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile:
> > cpsw_ale.o is added to multiple modules: keystone_netcp
> > keystone_netcp_ethss ti_cpsw ti_cpsw_new
> > scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile:
> > cpsw_ethtool.o is added to multiple modules: ti_cpsw ti_cpsw_new
> > scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile:
> > cpsw_priv.o is added to multiple modules: ti_cpsw ti_cpsw_new
> > scripts/Makefile.build:252: ./drivers/net/ethernet/ti/Makefile:
> > cpsw_sl.o is added to multiple modules: ti_cpsw ti_cpsw_new
>
> All of those five are tristate, that means with some of the
> corresponding Kconfig options set to `m` and some to `y`, the same
> objects are linked to a module and also to vmlinux even though the
> expected CFLAGS are different between builtins and modules.
> This is the same situation as fixed by
> commit 637a642f5ca5 ("zstd: Fixing mixed module-builtin objects").
> There's also no need to duplicate the same code 4 x 5 = roughly 20
> times.
>
> Introduce the new module, ti_cpsw_core, to provide the common
> functions used by all those modules.
>
> Fixes: 16f54164828b ("net: ethernet: ti: cpsw: drop CONFIG_TI_CPSW_ALE config option")
> Fixes: a8577e131266 ("net: ethernet: ti: netcp_ethss: fix build")
> Fixes: ed3525eda4c4 ("net: ethernet: ti: introduce cpsw switchdev based driver part 1 - dual-emac")
> Fixes: 93a76530316a ("net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver")
> Suggested-by: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> Signed-off-by: Alexander Lobakin <alobakin@xxxxx>
> ---
> drivers/net/ethernet/ti/Kconfig | 11 ++++++--
> drivers/net/ethernet/ti/Makefile | 12 ++++----
> drivers/net/ethernet/ti/am65-cpsw-nuss.c | 2 ++
> drivers/net/ethernet/ti/cpsw.c | 1 +
> drivers/net/ethernet/ti/cpsw_ale.c | 20 +++++++++++++
> drivers/net/ethernet/ti/cpsw_ethtool.c | 24 ++++++++++++++++
> drivers/net/ethernet/ti/cpsw_new.c | 1 +
> drivers/net/ethernet/ti/cpsw_priv.c | 36 ++++++++++++++++++++++++
> drivers/net/ethernet/ti/cpsw_sl.c | 8 ++++++
> drivers/net/ethernet/ti/netcp_core.c | 2 ++
> drivers/net/ethernet/ti/netcp_ethss.c | 2 ++
> 11 files changed, 112 insertions(+), 7 deletions(-)

As I commented on 09/18,
maybe 09/18 and 18/18 can be merged.





--
Best Regards
Masahiro Yamada