All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
To: "Sebastian Frias" <sf84@laposte.net>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org
Cc: lkml <linux-kernel@vger.kernel.org>, mason <slash.tmp@free.fr>
Subject: Re: [PATCH] net: phy: at803x: don't depend on GPIOLIB
Date: Mon, 21 Mar 2016 23:15:13 +0300	[thread overview]
Message-ID: <56F05651.3030706@cogentembedded.com> (raw)
In-Reply-To: <56E99727.9040702@laposte.net>

Hello.

On 03/16/2016 08:25 PM, Sebastian Frias wrote:

> Commit 687908c2b649 ("net: phy: at803x: simplify using
> devm_gpiod_get_optional and its 4th argument") introduced a dependency
> on GPIOLIB that was not there before.
>
> This commit removes such dependency by checking the return code and
> comparing it against ENOSYS which is returned when GPIOLIB is not
> selected.
>
> Fixes: 687908c2b649 ("net: phy: at803x: simplify using
> devm_gpiod_get_optional and its 4th argument")
>
> Signed-off-by: Sebastian Frias <sf84@laposte.net>

    Do you have the PHY that requires the GPIO reset workaround?
Askinjg because I have the patch adding the "reset-gpios" prop handling to 
phylib and your patch made me aware that I'll have to modify this driver in 
order to do that...

> ---
>   drivers/net/phy/at803x.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
> index 2174ec9..88b7ff3 100644
> --- a/drivers/net/phy/at803x.c
> +++ b/drivers/net/phy/at803x.c
> @@ -252,7 +252,9 @@ static int at803x_probe(struct phy_device *phydev)
>   		return -ENOMEM;
>
>   	gpiod_reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
> -	if (IS_ERR(gpiod_reset))
> +	if (PTR_ERR(gpiod_reset) == -ENOSYS)
> +		gpiod_reset = NULL;
> +	else if (IS_ERR(gpiod_reset))
    		return PTR_ERR(gpiod_reset);

    My patch basically gets rid of all this code. The thing that worries me is 
that the driver assumes that the reset singal is active low, despite what the 
GPIO specifier in the device tree has for the GPIO polarity. In fact, it will 
only work correctly if the specified has GPIO_ACTIVE_HIGH -- which is wrong 
because the reset signal is active low!
    Can you point me to an actual device tree using this erratic PHY?

WBR, Sergei

  parent reply	other threads:[~2016-03-21 20:15 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 17:25 [PATCH] net: phy: at803x: don't depend on GPIOLIB Sebastian Frias
2016-03-18 12:12 ` Mason
2016-03-18 12:54 ` Uwe Kleine-König
2016-03-18 12:54   ` Uwe Kleine-König
2016-03-18 15:56   ` Sebastian Frias
2016-03-18 19:12     ` Uwe Kleine-König
2016-03-18 19:31       ` Mason
2016-03-18 20:11         ` Uwe Kleine-König
2016-03-18 20:44           ` Mason
2016-03-19 10:01             ` Måns Rullgård
2016-03-21 12:48       ` Sebastian Frias
2016-03-21 12:48         ` Sebastian Frias
2016-03-21 13:54         ` Uwe Kleine-König
2016-03-21 15:36           ` Sebastian Frias
2016-03-21 20:12             ` Uwe Kleine-König
2016-03-22 14:34               ` Sebastian Frias
2016-03-22 19:42                 ` Uwe Kleine-König
2016-03-23 10:12                   ` Sebastian Frias
2016-03-23 10:49                     ` [PATCH] net: phy: at803x: Request 'reset' GPIO only for AT8030 PHY Sebastian Frias
2016-03-23 17:40                       ` David Miller
2016-03-23 19:42                       ` Sergei Shtylyov
2016-03-24  9:55                         ` Sebastian Frias
2016-03-24 10:10                           ` Sebastian Frias
2016-03-24 13:40                             ` Sergei Shtylyov
2016-03-23 10:17                   ` [PATCH] net: phy: at803x: don't depend on GPIOLIB Mason
2016-03-23 10:39                     ` Sergei Shtylyov
2016-03-23 10:55                       ` Sebastian Frias
2016-03-22 14:34     ` Sebastian Frias
2016-03-21 20:15 ` Sergei Shtylyov [this message]
2016-03-21 20:41   ` Uwe Kleine-König
2016-03-21 21:56     ` Sergei Shtylyov
2016-03-22 14:53     ` Sebastian Frias
2016-03-22 14:39   ` Sebastian Frias

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=56F05651.3030706@cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sf84@laposte.net \
    --cc=slash.tmp@free.fr \
    --cc=u.kleine-koenig@pengutronix.de \
    /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.