Re: [PATCH 18/18] net: cpsw: fix mixed module-builtin object
From: Masahiro Yamada <masahiroy@kernel.org>
Date: 2022-11-23 20:39:19
Also in:
linux-kbuild, lkml
On Sun, Nov 20, 2022 at 8:11 AM Alexander Lobakin [off-list ref] wrote:
Apart from cpdma, there are 4 object files shared in one way or another by 5 modules:quoted
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_newAll 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@kernel.org> Signed-off-by: Alexander Lobakin <redacted> --- 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