From: Florian Fainelli <florian@openwrt.org>
To: Arnd Bergmann <arnd@arndb.de>
Cc: David Miller <davem@davemloft.net>,
alexandre.belloni@free-electrons.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Russell King <linux@arm.linux.org.uk>,
shawn.guo@linaro.org, kernel@pengutronix.de
Subject: Re: [PATCHv2 1/3] net: phy: prevent linking breakage
Date: Tue, 4 Jun 2013 16:36:50 +0100 [thread overview]
Message-ID: <CAGVrzcbRS3x5fgD1BfOk4-oTUsAY9FA2V621OvZLJQNZ01brCg@mail.gmail.com> (raw)
In-Reply-To: <6466898.RnYOe3jpGG@wuerfel>
2013/6/4 Arnd Bergmann <arnd@arndb.de>:
>> Or you properly segregate the networking bits of the platform code so
>> that it can be built only when the necessary networking portions are
>> enabled.
>>
>> Sometimes having dummy stubs makes sense, but not in this situation.
>
> Currently most users of this function are doing something like
>
> static int foo_phy_fixup(struct phy_device *phydev)
> {
> ...
> }
>
> static int __init boo_board_init(void)
> {
> if (IS_BUILTIN(CONFIG_PHYLIB))
> phy_register_fixup_for_uid(phy_id, foo_phy_fixup);
> }
>
> which is practically the same as having a dummy stub. It leads to
> the foo_phy_fixup() function always getting compiled and then discarded
> by gcc when CONFIG_PHYLIB is disabled.
>
> The method is currently broken when network drivers are enabled as
> modules, because we are missing the fixup then.
>
> I think we should use IS_ENABLED() here to force a build error
> in that case, and have something like
>
> config ARCH_FOO
> bool "support for the foo platform"
> select PHYLIB if NET
>
> in the platform Kconfig file, to ensure PHYLIB is always built-in.
>
> I still think the inline alternatives would be helpful, but using
> if (IS_ENABLED(CONFIG_PHYLIB)) in the platform code would also
> work.
It seems to me that what David proposes is to have say an
arch/arm/mach-foo/phy-fixups.c file which is only enabled when
CONFIG_PHYLIB is set (obj-$(CONFIG_PHYLIB) += phy-fixup.o), such that
it does not need to have any conditionnals when calling
phy_register_fixup. This sounds a little unusual, but why not.
--
Florian
next prev parent reply other threads:[~2013-06-04 15:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-28 11:43 [PATCHv2 0/3] net: phy: prevent linking breakage Alexandre Belloni
2013-05-28 11:43 ` [PATCHv2 1/3] " Alexandre Belloni
2013-05-28 20:09 ` David Miller
2013-05-29 8:21 ` Alexandre Belloni
2013-05-30 9:42 ` David Miller
2013-06-04 15:07 ` Arnd Bergmann
2013-06-04 15:36 ` Florian Fainelli [this message]
2013-06-04 16:01 ` Arnd Bergmann
2013-06-04 16:09 ` Florian Fainelli
2013-06-04 17:17 ` Arnd Bergmann
2013-06-05 9:23 ` Alexandre Belloni
2013-06-05 11:21 ` Arnd Bergmann
2013-05-28 11:43 ` [PATCHv2 2/3] arm: mxs: don't check for CONFIG_PHYLIB as builtin Alexandre Belloni
2013-05-28 11:43 ` [PATCHv2 3/3] arm: imx: " Alexandre Belloni
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=CAGVrzcbRS3x5fgD1BfOk4-oTUsAY9FA2V621OvZLJQNZ01brCg@mail.gmail.com \
--to=florian@openwrt.org \
--cc=alexandre.belloni@free-electrons.com \
--cc=arnd@arndb.de \
--cc=davem@davemloft.net \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=shawn.guo@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).