linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Murray <andrew.murray@arm.com>
To: Thierry Reding <thierry.reding@gmail.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	linux-pci@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH 3/5] PCI: armada8x: Properly handle optional PHYs
Date: Wed, 28 Aug 2019 22:09:44 +0100	[thread overview]
Message-ID: <20190828210943.GE14582@e119886-lin.cambridge.arm.com> (raw)
In-Reply-To: <20190828163636.12967-3-thierry.reding@gmail.com>

On Wed, Aug 28, 2019 at 06:36:34PM +0200, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> devm_of_phy_get_by_index() can fail for a number of resides besides
> probe deferral. It can for example return -ENOMEM if it runs out of
> memory as it tries to allocate devres structures. Propagating only
> -EPROBE_DEFER is problematic because it results in these legitimately
> fatal errors being treated as "PHY not specified in DT".
> 
> What we really want is to ignore the optional PHYs only if they have not
> been specified in DT. devm_of_phy_get_by_index() returns -ENODEV in this
> case, so that's the special case that we need to handle. So we propagate
> all errors, except -ENODEV, so that real failures will still cause the
> driver to fail probe.
> 
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Signed-off-by: Thierry Reding <treding@nvidia.com>
> ---
>  drivers/pci/controller/dwc/pcie-armada8k.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/pci/controller/dwc/pcie-armada8k.c b/drivers/pci/controller/dwc/pcie-armada8k.c
> index 3d55dc78d999..49596547e8c2 100644
> --- a/drivers/pci/controller/dwc/pcie-armada8k.c
> +++ b/drivers/pci/controller/dwc/pcie-armada8k.c
> @@ -118,11 +118,10 @@ static int armada8k_pcie_setup_phys(struct armada8k_pcie *pcie)
>  
>  	for (i = 0; i < ARMADA8K_PCIE_MAX_LANES; i++) {
>  		pcie->phy[i] = devm_of_phy_get_by_index(dev, node, i);
> -		if (IS_ERR(pcie->phy[i]) &&
> -		    (PTR_ERR(pcie->phy[i]) == -EPROBE_DEFER))
> -			return PTR_ERR(pcie->phy[i]);
> -
>  		if (IS_ERR(pcie->phy[i])) {
> +			if (PTR_ERR(pcie->phy[i]) != -ENODEV)
> +				return PTR_ERR(pcie->phy[i]);
> +

Once you've applied Bjorn's feedback you can add:

Reviewed-by: Andrew Murray <andrew.murray@arm.com>

>  			pcie->phy[i] = NULL;
>  			continue;
>  		}
> -- 
> 2.22.0
> 

  reply	other threads:[~2019-08-28 21:09 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-28 16:36 [PATCH 1/5] PCI: exynos: Properly handle optional PHYs Thierry Reding
2019-08-28 16:36 ` [PATCH 2/5] PCI: imx6: Properly handle optional regulators Thierry Reding
2019-08-28 21:09   ` Andrew Murray
2019-08-28 16:36 ` [PATCH 3/5] PCI: armada8x: Properly handle optional PHYs Thierry Reding
2019-08-28 21:09   ` Andrew Murray [this message]
2019-08-28 16:36 ` [PATCH 4/5] PCI: histb: Properly handle optional regulators Thierry Reding
2019-08-28 21:09   ` Andrew Murray
2019-08-28 16:36 ` [PATCH 5/5] PCI: iproc: Properly handle optional PHYs Thierry Reding
2019-08-28 21:26   ` Andrew Murray
2019-08-28 21:49     ` Mark Brown
2019-08-29 10:09       ` Andrew Murray
2019-08-29 10:48         ` Thierry Reding
2019-08-29 12:13           ` Andrew Murray
2019-08-29 11:17         ` Mark Brown
2019-08-29 11:46           ` Thierry Reding
2019-08-29 12:08             ` Andrew Murray
2019-08-29 13:16               ` Mark Brown
2019-08-29 13:43                 ` Andrew Murray
2019-08-29 15:25                   ` Mark Brown
2019-08-29 13:03             ` Mark Brown
2019-08-29 14:58               ` Thierry Reding
2019-08-29 17:55                 ` Mark Brown
2019-08-28 17:54 ` [PATCH 1/5] PCI: exynos: " Bjorn Helgaas
2019-08-28 21:08 ` Andrew Murray

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=20190828210943.GE14582@e119886-lin.cambridge.arm.com \
    --to=andrew.murray@arm.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=thierry.reding@gmail.com \
    --cc=thomas.petazzoni@bootlin.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).