[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9235D6609DB808459E95D78E17F2E43D40B1C988@CHN-SV-EXMX02.mchp-main.com>
Date: Fri, 8 Sep 2017 20:03:05 +0000
From: <Woojung.Huh@...rochip.com>
To: <f.fainelli@...il.com>, <linus.walleij@...aro.org>
CC: <andrew@...n.ch>, <festevam@...il.com>,
<sergei.shtylyov@...entembedded.com>, <davem@...emloft.net>,
<netdev@...r.kernel.org>, <fabio.estevam@....com>,
<Bryan.Whitehead@...rochip.com>
Subject: RE: [PATCH net-next] mdio_bus: Remove unneeded gpiod NULL check
> >> I think it means CONFIG_GPIOLIB=n in the kernel because it's not needed,
> >> yet you run code (like drivers/net/phy/mdio_bus.c) that unconditionally
> >> calls into GPIOLIB and attempts to configure a given GPIO if available.
> > Yes. I'm facing issue on PC which won't need GPIOLIB as default.
> > Warning message goes away when GPIOLIB is enabled, and fortunately,
> > Ubuntu default config has it.
> > So, it may not be seen by many users when with full/default configuration.
>
> Woojung, I suppose you are also getting a warning from
> gpiod_set_value_cansleep() done in mdiobus_unregister() right? With
> CONFIG_GPIOLIB=n devm_gpiod_get_optional() returns NULL, which we
> don't
> check as an error, on purpose however we still call
> gpiod_set_value_cansleep() on a NULL GPIO descriptor, so the following
> should do:
>
> diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
> index b6f9fa670168..67dbb7c26840 100644
> --- a/drivers/net/phy/mdio_bus.c
> +++ b/drivers/net/phy/mdio_bus.c
> @@ -424,7 +424,8 @@ void mdiobus_unregister(struct mii_bus *bus)
> }
>
> /* Put PHYs in RESET to save power */
> - gpiod_set_value_cansleep(bus->reset_gpiod, 1);
> + if (!IS_ERR_OR_NULL(bus->reset_gpiod))
> + gpiod_set_value_cansleep(bus->reset_gpiod, 1);
>
> device_del(&bus->dev);
> }
Hi Florian,
Thanks for the patch. I'm avoiding warning with CONFIG_GPIOLIB=y for now.
I'm curious that there is a final conclusion to resolve this issue,
either with CONFIG_GPIOLIB=y or something else.
- Woojung
Powered by blists - more mailing lists