Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2407133rwb; Sat, 19 Nov 2022 15:38:30 -0800 (PST) X-Google-Smtp-Source: AA0mqf55zQaahwY4be6EKEqnAFaNYxdOnSuk7CyJMePpxwEQP8gHxsn7isCQeR4GYN+dc63Pqwtv X-Received: by 2002:aa7:db91:0:b0:458:bd09:1b20 with SMTP id u17-20020aa7db91000000b00458bd091b20mr11250255edt.176.1668901110204; Sat, 19 Nov 2022 15:38:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668901110; cv=none; d=google.com; s=arc-20160816; b=zNbl9eAnISEgiNp69aKB1FVa/MmQU6Uyqo8qF8tW4Jkp4ahE6pimAXulV3Entecrax sl44hRX+pVRnaKxc4dYS/p/ydBJvp97ixE0T84tFn7iO32OhhENEb7X1hIlenUBieCnD QjWk/NaqmouedYnFM0nn85H+xe5k8kpwpldHVugL8yDIB2IjagQqhtbFTr3EM5Mu5GZz ceIZur72xBn80uaD2mHEllBDCElfOG+sboZTFDcFyokFlRj1vPbYRg4lWdehxecJiP4k W8Clpt5BCrDh2cXbYb/BC02uNQukE3+QtqgWkcKmfFvs0vKeLwbiQnxdl8D5g2nmJ/OP ymyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :feedback-id:references:in-reply-to:message-id:subject:cc:from:to :dkim-signature:date; bh=MAgRAh4SDfMEPc3zacP7lfPCdvWAEe3d5ZwVSRUvOuA=; b=MiMblXaHLniHaiKi1gT4gZCExiTMEyKcORoo6eJrKN3UyTXJNcqum4d59cNxIJ43ja 6Rm0P/oP3GofbkhPiTd3emCpKXSc24LvM1fouWMqYB+DuoVSMknXJL0d+FS1xiJIFN8Q 3/ktml/Qrv5wqQycv3gJjZ5I4mVi9KMlEwBQ73C8DPtsSUSRJb7VVMHaNPbMK/hV2Sw7 9Sk3kTxL0Q/pc2ExCUWl/IxO9/XpksChpyGiPTLy0mcbOZK4pYWg4hJiuOghhzX6/9ez lFe5upsMHqOuDRgtguUwLAvPtr+VbDdQz9iTa9AWx4zCd7IQQKLU3M/tlqjVLR6je+hv oRtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail3 header.b=iZy0jG6A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ds15-20020a0564021ccf00b00459b51c2b25si6467616edb.438.2022.11.19.15.38.08; Sat, 19 Nov 2022 15:38:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@pm.me header.s=protonmail3 header.b=iZy0jG6A; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=pm.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233670AbiKSXJr (ORCPT + 90 others); Sat, 19 Nov 2022 18:09:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235311AbiKSXJf (ORCPT ); Sat, 19 Nov 2022 18:09:35 -0500 Received: from mail-40134.protonmail.ch (mail-40134.protonmail.ch [185.70.40.134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5EE91A239 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 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With CONFIG_NET_DSA_MSCC_FELIX=3Dm and CONFIG_NET_DSA_MSCC_SEVILLE=3Dy (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(-) diff --git a/drivers/net/dsa/ocelot/Kconfig b/drivers/net/dsa/ocelot/Kconfi= g 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 +=09tristate +=09select MSCC_OCELOT_SWITCH_LIB +=09select NET_DSA_TAG_OCELOT_8021Q +=09select NET_DSA_TAG_OCELOT +=09select PCS_LYNX + config NET_DSA_MSCC_FELIX =09tristate "Ocelot / Felix Ethernet switch support" =09depends on NET_DSA && PCI @@ -7,11 +15,8 @@ config NET_DSA_MSCC_FELIX =09depends on HAS_IOMEM =09depends on PTP_1588_CLOCK_OPTIONAL =09depends on NET_SCH_TAPRIO || NET_SCH_TAPRIO=3Dn -=09select MSCC_OCELOT_SWITCH_LIB -=09select NET_DSA_TAG_OCELOT_8021Q -=09select NET_DSA_TAG_OCELOT +=09select NET_DSA_MSCC_CORE =09select FSL_ENETC_MDIO -=09select PCS_LYNX =09help =09 This driver supports the VSC9959 (Felix) switch, which is embedded as =09 a PCIe function of the NXP LS1028A ENETC RCiEP. @@ -22,11 +27,8 @@ config NET_DSA_MSCC_SEVILLE =09depends on NET_VENDOR_MICROSEMI =09depends on HAS_IOMEM =09depends on PTP_1588_CLOCK_OPTIONAL +=09select NET_DSA_MSCC_CORE =09select MDIO_MSCC_MIIM -=09select MSCC_OCELOT_SWITCH_LIB -=09select NET_DSA_TAG_OCELOT_8021Q -=09select NET_DSA_TAG_OCELOT -=09select PCS_LYNX =09help =09 This driver supports the VSC9953 (Seville) switch, which is embedded =09 as a platform device on the NXP T1040 SoC. diff --git a/drivers/net/dsa/ocelot/Makefile b/drivers/net/dsa/ocelot/Makef= ile 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) +=3D mscc_core.o obj-$(CONFIG_NET_DSA_MSCC_FELIX) +=3D mscc_felix.o obj-$(CONFIG_NET_DSA_MSCC_SEVILLE) +=3D mscc_seville.o -mscc_felix-objs :=3D \ -=09felix.o \ -=09felix_vsc9959.o - -mscc_seville-objs :=3D \ -=09felix.o \ -=09seville_vsc9953.o +mscc_core-objs :=3D felix.o +mscc_felix-objs :=3D felix_vsc9959.o +mscc_seville-objs :=3D 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 =3D { =09.port_set_host_flood=09=09=3D felix_port_set_host_flood, =09.port_change_master=09=09=3D 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) =09return 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) =09return 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/ocelo= t/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 =3D= { }; 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/oce= lot/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 = =3D { }; module_platform_driver(seville_vsc9953_driver); +MODULE_IMPORT_NS(NET_DSA_MSCC_CORE); + MODULE_DESCRIPTION("Seville Switch driver"); MODULE_LICENSE("GPL v2"); -- 2.38.1