public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <alobakin@pm.me>
To: linux-kbuild@vger.kernel.org
Cc: Alexander Lobakin <alobakin@pm.me>,
	Masahiro Yamada <masahiroy@kernel.org>,
	Nicolas Schier <nicolas@fjasle.eu>, Jens Axboe <axboe@kernel.dk>,
	Boris Brezillon <bbrezillon@kernel.org>,
	Borislav Petkov <bp@alien8.de>, Tony Luck <tony.luck@intel.com>,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Vladimir Oltean <vladimir.oltean@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Derek Chickles <dchickles@marvell.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Salil Mehta <salil.mehta@huawei.com>,
	Sunil Goutham <sgoutham@marvell.com>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Daniel Scally <djrscally@gmail.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Mark Brown <broonie@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	NXP Linux Team <linux-imx@nxp.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 14/18] dsa: ocelot: fix mixed module-builtin object
Date: Sat, 19 Nov 2022 23:09:28 +0000	[thread overview]
Message-ID: <20221119225650.1044591-15-alobakin@pm.me> (raw)
In-Reply-To: <20221119225650.1044591-1-alobakin@pm.me>

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 <masahiroy@kernel.org>
Signed-off-by: Alexander Lobakin <alobakin@pm.me>
---
 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/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");
--
2.38.1



  parent reply	other threads:[~2022-11-19 23:09 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-19 23:03 [PATCH 00/18] treewide: fix object files shared between several modules Alexander Lobakin
2022-11-19 23:04 ` [PATCH 01/18] block/rnbd: fix mixed module-builtin object Alexander Lobakin
2022-11-21 21:17   ` Andrew Davis
2022-11-22  5:59     ` Masahiro Yamada
2022-11-29 18:24       ` Andrew Davis
2022-11-19 23:04 ` [PATCH 02/18] drm/bridge: imx: " Alexander Lobakin
2022-11-19 23:05 ` [PATCH 03/18] drm/bridge: imx: turn imx8{qm,qxp}-ldb into single-object modules Alexander Lobakin
2022-11-19 23:05 ` [PATCH 04/18] sound: fix mixed module-builtin object Alexander Lobakin
2022-11-19 23:05 ` [PATCH 05/18] mfd: rsmu: " Alexander Lobakin
2022-11-19 23:06 ` [PATCH 06/18] mfd: rsmu: turn rsmu-{core,i2c,spi} into single-object modules Alexander Lobakin
2022-11-19 23:06 ` [PATCH 07/18] net: liquidio: fix mixed module-builtin object Alexander Lobakin
2022-11-19 23:06 ` [PATCH 08/18] net: enetc: " Alexander Lobakin
2022-11-23 13:03   ` Masahiro Yamada
2022-11-19 23:07 ` [PATCH 09/18] net: emac, cpsw: fix mixed module-builtin object (davinci_cpdma) Alexander Lobakin
2022-11-23 16:04   ` Masahiro Yamada
2022-11-19 23:07 ` [PATCH 10/18] EDAC: i10nm, skx: fix mixed module-builtin object Alexander Lobakin
2022-11-23 16:12   ` Masahiro Yamada
2022-11-19 23:08 ` [PATCH 11/18] platform/x86: int3472: fix object shared between several modules Alexander Lobakin
2022-11-20 13:55   ` Andy Shevchenko
2022-11-20 20:54     ` Hans de Goede
2022-11-20 23:45       ` Masahiro Yamada
2022-11-21  8:12         ` Hans de Goede
2022-11-21  9:06           ` Masahiro Yamada
2022-11-21  9:34             ` Hans de Goede
2022-11-23 21:19               ` Alexander Lobakin
2022-11-23 21:10           ` Alexander Lobakin
2022-11-23  0:01     ` Alexander Lobakin
2022-11-19 23:08 ` [PATCH 12/18] mtd: tests: " Alexander Lobakin
2022-11-23 13:11   ` Masahiro Yamada
2022-11-23 16:59     ` Miquel Raynal
2022-11-24 11:31       ` Miquel Raynal
2022-11-19 23:09 ` [PATCH 13/18] crypto: octeontx2: fix objects " Alexander Lobakin
2022-11-23 16:26   ` Masahiro Yamada
2022-11-19 23:09 ` Alexander Lobakin [this message]
2022-11-21 17:55   ` [PATCH 14/18] dsa: ocelot: fix mixed module-builtin object Vladimir Oltean
2022-11-21 18:12     ` Colin Foster
2022-11-21 21:02       ` Vladimir Oltean
2022-11-23 21:31       ` Alexander Lobakin
2022-11-23 21:47       ` Alexander Lobakin
2022-11-23 22:18         ` Colin Foster
2022-11-23 22:36           ` Vladimir Oltean
2022-11-21 18:59     ` Andy Shevchenko
2022-11-19 23:09 ` [PATCH 15/18] net: dpaa2: " Alexander Lobakin
2022-11-23 21:02   ` Masahiro Yamada
2022-11-19 23:10 ` [PATCH 16/18] net: hns3: " Alexander Lobakin
2022-11-22 12:39   ` Salil Mehta
2022-11-23 22:07     ` Alexander Lobakin
2022-11-24  9:58       ` Salil Mehta
2022-11-19 23:10 ` [PATCH 17/18] net: octeontx2: " Alexander Lobakin
2022-11-23 20:54   ` Masahiro Yamada
2022-11-19 23:10 ` [PATCH 18/18] net: cpsw: " Alexander Lobakin
2022-11-23 20:37   ` Masahiro Yamada
2022-11-20 11:58 ` [PATCH 00/18] treewide: fix object files shared between several modules Mark Brown
2022-11-20 12:26   ` Conor Dooley
2022-11-22 11:28     ` Mark Brown
2022-11-22 21:37   ` Alexander Lobakin
2022-11-23 11:51     ` Mark Brown
2022-11-21 19:50 ` Jakub Kicinski
2022-11-23 21:40   ` Alexander Lobakin
2022-11-23 21:39 ` Masahiro Yamada
2023-02-10 17:31 ` Alexander Lobakin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221119225650.1044591-15-alobakin@pm.me \
    --to=alobakin@pm.me \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=axboe@kernel.dk \
    --cc=bbrezillon@kernel.org \
    --cc=bp@alien8.de \
    --cc=broonie@kernel.org \
    --cc=dchickles@marvell.com \
    --cc=djrscally@gmail.com \
    --cc=grygorii.strashko@ti.com \
    --cc=hdegoede@redhat.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=linux-imx@nxp.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masahiroy@kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=netdev@vger.kernel.org \
    --cc=nicolas@fjasle.eu \
    --cc=salil.mehta@huawei.com \
    --cc=sgoutham@marvell.com \
    --cc=tony.luck@intel.com \
    --cc=vladimir.oltean@nxp.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox