netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@corigine.com>
To: Sebastian Reichel <sebastian.reichel@collabora.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Jose Abreu <joabreu@synopsys.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel@collabora.com
Subject: Re: [PATCHv2 2/2] net: ethernet: stmmac: dwmac-rk: fix optional phy regulator handling
Date: Wed, 5 Apr 2023 19:43:15 +0200	[thread overview]
Message-ID: <ZC2zMzaUMY0/VCRR@corigine.com> (raw)
In-Reply-To: <20230405161043.46190-3-sebastian.reichel@collabora.com>

On Wed, Apr 05, 2023 at 06:10:43PM +0200, Sebastian Reichel wrote:
> The usual devm_regulator_get() call already handles "optional"
> regulators by returning a valid dummy and printing a warning
> that the dummy regulator should be described properly. This
> code open coded the same behaviour, but masked any errors that
> are not -EPROBE_DEFER and is quite noisy.
> 
> This change effectively unmasks and propagates regulators errors
> not involving -ENODEV, downgrades the error print to warning level
> if no regulator is specified and captures the probe defer message
> for /sys/kernel/debug/devices_deferred.
> 
> Fixes: 2e12f536635f8 ("net: stmmac: dwmac-rk: Use standard devicetree property for phy regulator")
> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
> ---
>  drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c | 11 ++++-------
>  1 file changed, 4 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> index 6fdad0f10d6f..d9deba110d4b 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-rk.c
> @@ -1656,14 +1656,11 @@ static struct rk_priv_data *rk_gmac_setup(struct platform_device *pdev,
>  		}
>  	}
>  
> -	bsp_priv->regulator = devm_regulator_get_optional(dev, "phy");
> +	bsp_priv->regulator = devm_regulator_get(dev, "phy");
>  	if (IS_ERR(bsp_priv->regulator)) {
> -		if (PTR_ERR(bsp_priv->regulator) == -EPROBE_DEFER) {
> -			dev_err(dev, "phy regulator is not available yet, deferred probing\n");
> -			return ERR_PTR(-EPROBE_DEFER);
> -		}
> -		dev_err(dev, "no regulator found\n");
> -		bsp_priv->regulator = NULL;

Does phy_power_on() need to be updated for this change?
F.e. Does the bsp_priv->regulator == NULL still make sense?

> +		ret = PTR_ERR(bsp_priv->regulator);
> +		dev_err_probe(dev, ret, "failed to get phy regulator\n");
> +		return ERR_PTR(ret);
>  	}
>  
>  	ret = of_property_read_string(dev->of_node, "clock_in_out", &strings);
> -- 
> 2.39.2
> 

  reply	other threads:[~2023-04-05 17:43 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-05 16:10 [PATCHv2 0/2] Fix RK3588 error prints Sebastian Reichel
2023-04-05 16:10 ` [PATCHv2 1/2] net: ethernet: stmmac: dwmac-rk: rework optional clock handling Sebastian Reichel
2023-04-05 17:42   ` Simon Horman
2023-04-05 19:05   ` Andrew Lunn
2023-04-05 16:10 ` [PATCHv2 2/2] net: ethernet: stmmac: dwmac-rk: fix optional phy regulator handling Sebastian Reichel
2023-04-05 17:43   ` Simon Horman [this message]
2023-04-05 18:20     ` Sebastian Reichel

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=ZC2zMzaUMY0/VCRR@corigine.com \
    --to=simon.horman@corigine.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=joabreu@synopsys.com \
    --cc=kernel@collabora.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=sebastian.reichel@collabora.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;
as well as URLs for NNTP newsgroup(s).