From: f.fainelli@gmail.com (Florian Fainelli)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] net: phy: prevent linking breakage
Date: Tue, 28 May 2013 00:20:05 +0200 [thread overview]
Message-ID: <201305272320.08296.f.fainelli@gmail.com> (raw)
In-Reply-To: <51A399D6.8030000@free-electrons.com>
Hi,
Le 27 mai 2013 19:38, "Alexandre Belloni" <alexandre.belloni@free-
electrons.com> a ?crit :
[snip]
> >> +/*
> >> + * phy_register_fixup{,_for_uid,_for_id} are called from arch/ so this
won't
> >> + * work unless phylib is compiled in the kernel.
> >> + * Defining stubs allows to prevent linking errors.
> >> + */
> >> +#ifdef CONFIG_PHYLIB
> >> int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
> >> int (*run)(struct phy_device *));
> >> int phy_register_fixup_for_id(const char *bus_id,
> >> int (*run)(struct phy_device *));
> >> int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
> >> int (*run)(struct phy_device *));
> >> +#else
> >> +#define phy_register_fixup(a, b, c, d) do { } while (0)
> >> +#define phy_register_fixup_for_id(a, b) do { } while (0)
> >> +#define phy_register_fixup_for_uid(a, b, c) do { } while (0)
> > Use static inline functions here. This breaks if someone does result
> > checking on the functions which then expands to ret = do {} while (0);
> > Also we still have
> Right, I tried that first but forgot static so I had issues with
> redefinition of the functions. I even played with __weak at some point...
You might even want to make these static inlines as mentionned earlier, and
return something like -ENOTSUPP so that someone using these in board code and
wondering why they do not work gets a chance to enable CONIFG_PHYLIB.
--
Florian
WARNING: multiple messages have this Message-ID (diff)
From: Florian Fainelli <f.fainelli@gmail.com>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Cc: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org,
Shawn Guo <shawn.guo@linaro.org>,
Russell King <linux@arm.linux.org.uk>,
Sascha Hauer <kernel@pengutronix.de>,
linux-kernel@vger.kernel.org,
Sascha Hauer <s.hauer@pengutronix.de>
Subject: Re: [PATCH 1/3] net: phy: prevent linking breakage
Date: Tue, 28 May 2013 00:20:05 +0200 [thread overview]
Message-ID: <201305272320.08296.f.fainelli@gmail.com> (raw)
In-Reply-To: <51A399D6.8030000@free-electrons.com>
Hi,
Le 27 mai 2013 19:38, "Alexandre Belloni" <alexandre.belloni@free-
electrons.com> a écrit :
[snip]
> >> +/*
> >> + * phy_register_fixup{,_for_uid,_for_id} are called from arch/ so this
won't
> >> + * work unless phylib is compiled in the kernel.
> >> + * Defining stubs allows to prevent linking errors.
> >> + */
> >> +#ifdef CONFIG_PHYLIB
> >> int phy_register_fixup(const char *bus_id, u32 phy_uid, u32 phy_uid_mask,
> >> int (*run)(struct phy_device *));
> >> int phy_register_fixup_for_id(const char *bus_id,
> >> int (*run)(struct phy_device *));
> >> int phy_register_fixup_for_uid(u32 phy_uid, u32 phy_uid_mask,
> >> int (*run)(struct phy_device *));
> >> +#else
> >> +#define phy_register_fixup(a, b, c, d) do { } while (0)
> >> +#define phy_register_fixup_for_id(a, b) do { } while (0)
> >> +#define phy_register_fixup_for_uid(a, b, c) do { } while (0)
> > Use static inline functions here. This breaks if someone does result
> > checking on the functions which then expands to ret = do {} while (0);
> > Also we still have
> Right, I tried that first but forgot static so I had issues with
> redefinition of the functions. I even played with __weak at some point...
You might even want to make these static inlines as mentionned earlier, and
return something like -ENOTSUPP so that someone using these in board code and
wondering why they do not work gets a chance to enable CONIFG_PHYLIB.
--
Florian
next prev parent reply other threads:[~2013-05-27 22:20 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-27 16:18 [PATCH 0/3] net: phy: prevent linking breakage Alexandre Belloni
2013-05-27 16:18 ` Alexandre Belloni
2013-05-27 16:18 ` [PATCH 1/3] " Alexandre Belloni
2013-05-27 16:18 ` Alexandre Belloni
2013-05-27 16:39 ` Sascha Hauer
2013-05-27 16:39 ` Sascha Hauer
2013-05-27 17:37 ` Alexandre Belloni
2013-05-27 17:37 ` Alexandre Belloni
2013-05-27 22:20 ` Florian Fainelli [this message]
2013-05-27 22:20 ` Florian Fainelli
2013-05-27 16:18 ` [PATCH 2/3] arm: mxs: don't check for CONFIG_PHYLIB as builtin Alexandre Belloni
2013-05-27 16:18 ` Alexandre Belloni
2013-05-27 16:18 ` [PATCH 3/3] arm: imx: " Alexandre Belloni
2013-05-27 16:18 ` 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=201305272320.08296.f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.