From patchwork Sat Nov 19 23:09:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Lobakin X-Patchwork-Id: 13049852 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0647C4332F for ; Sat, 19 Nov 2022 23:09:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235308AbiKSXJq (ORCPT ); Sat, 19 Nov 2022 18:09:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33716 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235310AbiKSXJf (ORCPT ); Sat, 19 Nov 2022 18:09:35 -0500 Received: from mail-40131.protonmail.ch (mail-40131.protonmail.ch [185.70.40.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5F541A23F for ; Sat, 19 Nov 2022 15:09:34 -0800 (PST) Date: Sat, 19 Nov 2022 23:09:28 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pm.me; s=protonmail3; t=1668899373; x=1669158573; bh=MAgRAh4SDfMEPc3zacP7lfPCdvWAEe3d5ZwVSRUvOuA=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=iZy0jG6AkPETIeHEmKHqgjE6t1Q+kVlflbMPgugjFGCbpEBsYs6e7T8XI0dLJ6kJV xS89AcZITBR2RDXUo0/sxT1ekJ8nna+ZChqg5QgMQPF88+VHZ+NrhXK1ZJP0vU+QwR 8oWyoEYw3BZJe/K3GNY6Tlpa2mMheAfUboSTYGtaAKuXvEGmLg0ZHLOemddovtvEF0 VA9KZ9tkSxzGlSwjWBAQNFTfhpNuywVhJvvqwObruB/CRB1M+FqXZ5kSGW67syu/cO 7dH5364Wb2/svC+oBdNlfh7UkQWEZd6pceCI3Mit/GSOfuk0oPlEBzNRbS29S4wEOn 8y8zXZokmhmaw== To: linux-kbuild@vger.kernel.org From: Alexander Lobakin Cc: Alexander Lobakin , Masahiro Yamada , Nicolas Schier , Jens Axboe , Boris Brezillon , Borislav Petkov , Tony Luck , Miquel Raynal , Vladimir Oltean , Alexandre Belloni , Derek Chickles , Ioana Ciornei , Salil Mehta , Sunil Goutham , Grygorii Strashko , Daniel Scally , Hans de Goede , Mark Brown , Andy Shevchenko , NXP Linux Team , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 14/18] dsa: ocelot: fix mixed module-builtin object Message-ID: <20221119225650.1044591-15-alobakin@pm.me> In-Reply-To: <20221119225650.1044591-1-alobakin@pm.me> References: <20221119225650.1044591-1-alobakin@pm.me> Feedback-ID: 22809121:user:proton MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org With CONFIG_NET_DSA_MSCC_FELIX=m and CONFIG_NET_DSA_MSCC_SEVILLE=y (or vice versa), felix.o 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 relatively big piece of object code into two modules. Introduce the new module, mscc_core, to provide the common functions to both mscc_felix and mscc_seville. Fixes: d60bc62de4ae ("net: dsa: seville: build as separate module") Suggested-by: Masahiro Yamada Signed-off-by: Alexander Lobakin --- drivers/net/dsa/ocelot/Kconfig | 18 ++++++++++-------- drivers/net/dsa/ocelot/Makefile | 12 +++++------- drivers/net/dsa/ocelot/felix.c | 6 ++++++ drivers/net/dsa/ocelot/felix_vsc9959.c | 2 ++ drivers/net/dsa/ocelot/seville_vsc9953.c | 2 ++ 5 files changed, 25 insertions(+), 15 deletions(-) -- 2.38.1 diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfig index 08db9cf76818..59845274e374 100644 --- a/drivers/net/dsa/ocelot/Kconfig +++ b/drivers/net/dsa/ocelot/Kconfig @@ -1,4 +1,12 @@ # SPDX-License-Identifier: GPL-2.0-only + +config NET_DSA_MSCC_CORE + tristate + select MSCC_OCELOT_SWITCH_LIB + select NET_DSA_TAG_OCELOT_8021Q + select NET_DSA_TAG_OCELOT + select PCS_LYNX + config NET_DSA_MSCC_FELIX tristate "Ocelot / Felix Ethernet switch support" depends on NET_DSA && PCI @@ -7,11 +15,8 @@ config NET_DSA_MSCC_FELIX depends on HAS_IOMEM depends on PTP_1588_CLOCK_OPTIONAL depends on NET_SCH_TAPRIO || NET_SCH_TAPRIO=n - select MSCC_OCELOT_SWITCH_LIB - select NET_DSA_TAG_OCELOT_8021Q - select NET_DSA_TAG_OCELOT + select NET_DSA_MSCC_CORE select FSL_ENETC_MDIO - select PCS_LYNX help This driver supports the VSC9959 (Felix) switch, which is embedded as a PCIe function of the NXP LS1028A ENETC RCiEP. @@ -22,11 +27,8 @@ config NET_DSA_MSCC_SEVILLE depends on NET_VENDOR_MICROSEMI depends on HAS_IOMEM depends on PTP_1588_CLOCK_OPTIONAL + select NET_DSA_MSCC_CORE select MDIO_MSCC_MIIM - select MSCC_OCELOT_SWITCH_LIB - select NET_DSA_TAG_OCELOT_8021Q - select NET_DSA_TAG_OCELOT - select PCS_LYNX help This driver supports the VSC9953 (Seville) switch, which is embedded as a platform device on the NXP T1040 SoC. diff --git a/drivers/net/dsa/ocelot/Makefile b/drivers/net/dsa/ocelot/Makefile index f6dd131e7491..f8c74b59b996 100644 --- a/drivers/net/dsa/ocelot/Makefile +++ b/drivers/net/dsa/ocelot/Makefile @@ -1,11 +1,9 @@ # SPDX-License-Identifier: GPL-2.0-only + +obj-$(CONFIG_NET_DSA_MSCC_CORE) += mscc_core.o obj-$(CONFIG_NET_DSA_MSCC_FELIX) += mscc_felix.o obj-$(CONFIG_NET_DSA_MSCC_SEVILLE) += mscc_seville.o -mscc_felix-objs := \ - felix.o \ - felix_vsc9959.o - -mscc_seville-objs := \ - felix.o \ - seville_vsc9953.o +mscc_core-objs := felix.o +mscc_felix-objs := felix_vsc9959.o +mscc_seville-objs := seville_vsc9953.o diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index dd3a18cc89dd..f9d0a24ebc3a 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -2112,6 +2112,7 @@ const struct dsa_switch_ops felix_switch_ops = { .port_set_host_flood = felix_port_set_host_flood, .port_change_master = felix_port_change_master, }; +EXPORT_SYMBOL_NS_GPL(felix_switch_ops, NET_DSA_MSCC_CORE); struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port) { @@ -2123,6 +2124,7 @@ struct net_device *felix_port_to_netdev(struct ocelot *ocelot, int port) return dsa_to_port(ds, port)->slave; } +EXPORT_SYMBOL_NS_GPL(felix_port_to_netdev, NET_DSA_MSCC_CORE); int felix_netdev_to_port(struct net_device *dev) { @@ -2134,3 +2136,7 @@ int felix_netdev_to_port(struct net_device *dev) return dp->index; } +EXPORT_SYMBOL_NS_GPL(felix_netdev_to_port, NET_DSA_MSCC_CORE); + +MODULE_DESCRIPTION("MSCC Switch driver core"); +MODULE_LICENSE("GPL"); diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 26a35ae322d1..52c8bff79fa3 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2736,5 +2736,7 @@ static struct pci_driver felix_vsc9959_pci_driver = { }; module_pci_driver(felix_vsc9959_pci_driver); +MODULE_IMPORT_NS(NET_DSA_MSCC_CORE); + MODULE_DESCRIPTION("Felix Switch driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/net/dsa/ocelot/seville_vsc9953.c b/drivers/net/dsa/ocelot/seville_vsc9953.c index 7af33b2c685d..e9c63c642489 100644 --- a/drivers/net/dsa/ocelot/seville_vsc9953.c +++ b/drivers/net/dsa/ocelot/seville_vsc9953.c @@ -1115,5 +1115,7 @@ static struct platform_driver seville_vsc9953_driver = { }; module_platform_driver(seville_vsc9953_driver); +MODULE_IMPORT_NS(NET_DSA_MSCC_CORE); + MODULE_DESCRIPTION("Seville Switch driver"); MODULE_LICENSE("GPL v2");