From: Florian Fainelli <f.fainelli@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"David S. Miller" <davem@davemloft.net>,
Andrew Lunn <andrew@lunn.ch>, Fabio Estevam <festevam@gmail.com>,
Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
Fabio Estevam <fabio.estevam@nxp.com>,
Bryan.Whitehead@microchip.com
Subject: Re: [PATCH net] Revert "mdio_bus: Remove unneeded gpiod NULL check"
Date: Fri, 8 Sep 2017 16:18:49 -0700 [thread overview]
Message-ID: <fe6846be-afc3-1025-d78a-96674e1b2a35@gmail.com> (raw)
In-Reply-To: <CACRpkdZD-nRXXusX36Gaypf5A601CMEO3vVgaOV5tKufvy1M3Q@mail.gmail.com>
On 09/08/2017 04:13 PM, Linus Walleij wrote:
> On Sat, Sep 9, 2017 at 12:38 AM, Florian Fainelli <f.fainelli@gmail.com> wrote:
>
>> This reverts commit 95b80bf3db03c2bf572a357cf74b9a6aefef0a4a ("mdio_bus:
>> Remove unneeded gpiod NULL check"), this commit assumed that GPIOLIB
>> checks for NULL descriptors, so it's safe to drop them, but it is not
>> when CONFIG_GPIOLIB is disabled in the kernel. If we do call
>> gpiod_set_value_cansleep() on a GPIO descriptor we will issue warnings
>> coming from the inline stubs declared in include/linux/gpio/consumer.h.
>>
>> Fixes: 95b80bf3db03 ("mdio_bus: Remove unneeded gpiod NULL check")
>> Reported-by: Woojung Huh <Woojung.Huh@microchip.com>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>
> Yeah I guess you don't wanna have these messages spewing
> in the console. :/
>
> But what about simply doing this:
That would create another dependency which really does not need to be
there as it really prevents you from testing more configurations,
including but not limited to having CONFIG_GPIOLIB=n w/
CONFIG_MDIO_DEVICE=[ym].
The GPIOLIB=n inline stubs have a "contract" with the code calling them
that is fairly clear, which is what this revert is leveraging.
Instead of doing what you suggest, we could also encapsulate the
offending code within an #IS_ENABLED(CONFIG_GPIOLIB) block, which would
be virtually the same thing in terms of object code generated, but would
make it clear there is a functional dependency, I would personally be
keener on that approach than having a select or depends.
Thanks
>
>
> From 150e4f3c1f227c9a4c31bbb48d44220e25b792ec Mon Sep 17 00:00:00 2001
> From: Linus Walleij <linus.walleij@linaro.org>
> Date: Sat, 9 Sep 2017 01:07:22 +0200
> Subject: [PATCH] net: phy: mdio_bus: mandate gpiolib
>
> The core mdio bus unconditionally uses gpiolib APIs to handle
> reset lines which results in runtime errors when it is compiled
> out. It is not supposed to be possible to stub out gpiolib
> like this, the error messages from the stubs are a sign that
> something is wrong.
>
> So just select it. Fix some unneeded #includes while we're
> at it.>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/net/phy/Kconfig | 1 +
> drivers/net/phy/mdio_bus.c | 2 --
> 2 files changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/net/phy/Kconfig b/drivers/net/phy/Kconfig
> index a9d16a3af514..b6c5bb9941c3 100644
> --- a/drivers/net/phy/Kconfig
> +++ b/drivers/net/phy/Kconfig
> @@ -4,6 +4,7 @@
>
> menuconfig MDIO_DEVICE
> tristate "MDIO bus device drivers"
> + select GPIOLIB
> help
> MDIO devices and driver infrastructure code.
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index b6f9fa670168..9c60f87b7209 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -22,11 +22,9 @@
> #include <linux/init.h>
> #include <linux/delay.h>
> #include <linux/device.h>
> -#include <linux/gpio.h>
> #include <linux/gpio/consumer.h>
> #include <linux/of_device.h>
> #include <linux/of_mdio.h>
> -#include <linux/of_gpio.h>
> #include <linux/netdevice.h>
> #include <linux/etherdevice.h>
> #include <linux/skbuff.h>
>
--
Florian
next prev parent reply other threads:[~2017-09-08 23:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-08 22:38 [PATCH net] Revert "mdio_bus: Remove unneeded gpiod NULL check" Florian Fainelli
2017-09-08 23:13 ` Linus Walleij
2017-09-08 23:18 ` Florian Fainelli [this message]
2017-09-08 23:24 ` Linus Walleij
2017-09-09 4:13 ` David Miller
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=fe6846be-afc3-1025-d78a-96674e1b2a35@gmail.com \
--to=f.fainelli@gmail.com \
--cc=Bryan.Whitehead@microchip.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=fabio.estevam@nxp.com \
--cc=festevam@gmail.com \
--cc=linus.walleij@linaro.org \
--cc=netdev@vger.kernel.org \
--cc=sergei.shtylyov@cogentembedded.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