Netdev List
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Vladimir Oltean" <vladimir.oltean@nxp.com>,
	"Arnd Bergmann" <arnd@kernel.org>,
	"Ioana Ciornei" <ioana.ciornei@nxp.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <simon.horman@corigine.com>,
	"Russell King" <linux@armlinux.org.uk>,
	"Russell King" <rmk+kernel@armlinux.org.uk>,
	"Josua Mayer" <josua@solid-run.com>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Sean Anderson" <sean.anderson@seco.com>,
	Netdev <netdev@vger.kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] [v2] dpaa: avoid linking objects into multiple modules
Date: Mon, 30 Mar 2026 16:08:10 +0200	[thread overview]
Message-ID: <d0cf4b6b-39e6-44da-916c-07f935b7ee4b@app.fastmail.com> (raw)
In-Reply-To: <20230725205933.yqvdy3h7hewbjosy@skbuf>

On Tue, Jul 25, 2023, at 22:59, Vladimir Oltean wrote:
> On Tue, Jul 25, 2023 at 10:39:40PM +0200, Arnd Bergmann wrote:
>> From: Arnd Bergmann <arnd@arndb.de>
>> 
>> Each object file contains information about which module it gets linked
>> into, so linking the same file into multiple modules now causes a warning:

A recent change broke my earlier patch, and I noticed I had this
version sitting in my randconfig tree for multiple years now, so
I refreshed it now, sorry for dropping the ball earlier.
 
>> scripts/Makefile.build:254: drivers/net/ethernet/freescale/dpaa2/Makefile: dpaa2-mac.o is added to multiple modules: fsl-dpaa2-eth fsl-dpaa2-switch
>> scripts/Makefile.build:254: drivers/net/ethernet/freescale/dpaa2/Makefile: dpmac.o is added to multiple modules: fsl-dpaa2-eth fsl-dpaa2-switch
>> 
>> Chang the way that dpaa2 is built by moving the two common files into a
>> separate module with exported symbols instead.
>> 
>> To avoid a link failure when the switch driver is built-in, but the dpio driver
>> is a loadable module, add the same dependency in there that exists for
>> the ethernet driver.
>
> Unrelated change should be separate.

This was fixed independently and is gone from v3

> There was a previous attempt at this before, by Alexander Lobakin:
> https://patchwork.kernel.org/project/netdevbpf/patch/20221119225650.1044591-16-alobakin@pm.me/
>
> but it seems he wasn't persistent enough with it.
>
> Something which I liked better in his proposal was the naming of the
> config option (FSL_DPAA2_MAC) and of the new module (fsl-dpaa2-mac).

I renamed the module, but did not introduce a Kconfig symbol.
The same thing can be done either using Kconfig or Makefile
logic, and I just kept my previous approach here.

>> -obj-$(CONFIG_FSL_DPAA2_ETH)		+= fsl-dpaa2-eth.o
>> +obj-$(CONFIG_FSL_DPAA2_ETH)		+= fsl-dpaa2-eth.o fsl-dpaa2-common.o
>>  obj-$(CONFIG_FSL_DPAA2_PTP_CLOCK)	+= fsl-dpaa2-ptp.o
>> -obj-$(CONFIG_FSL_DPAA2_SWITCH)		+= fsl-dpaa2-switch.o
>> +obj-$(CONFIG_FSL_DPAA2_SWITCH)		+= fsl-dpaa2-switch.o fsl-dpaa2-common.o
>
> I am not completely sure how this works. Can fsl-dpaa2-common appear
> both in obj-y (added by $(CONFIG_FSL_DPAA2_ETH)) and in obj-m (added by
> $(CONFIG_FSL_DPAA2_SWITCH))? Olek proposed the introduction of a new,
> hidden and selectable tristate FSL_DPAA2_MAC. At least I understand how
> that works.

Yes, this is a Kbuild feature: if a module is both obj-y and obj-m, it
is built into the kernel and the second one is dropped. The effect is
exactly equivalent to having a silent Kconfig symbol FSL_DPAA2_MAC
that is selected by both others.
  
>> +
>> +MODULE_LICENSE("GPL");
>> +MODULE_DESCRIPTION("DPAA2 Ethernet core library");
>
> s/core/MAC/ everywhere

Done.

       Arnd

  reply	other threads:[~2026-03-30 14:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-25 20:39 [PATCH] [v2] dpaa: avoid linking objects into multiple modules Arnd Bergmann
2023-07-25 20:59 ` Vladimir Oltean
2026-03-30 14:08   ` Arnd Bergmann [this message]
2023-08-12 11:40 ` kernel test robot

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=d0cf4b6b-39e6-44da-916c-07f935b7ee4b@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=arnd@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=josua@solid-run.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rmk+kernel@armlinux.org.uk \
    --cc=sean.anderson@seco.com \
    --cc=simon.horman@corigine.com \
    --cc=vladimir.oltean@nxp.com \
    --cc=wsa+renesas@sang-engineering.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