Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1351320 > unrolled thread

[PATCH] PCI/keystone: check return value of devm_phy_get with EPROBE_DEFER

Started byShawn Lin <shawn.lin@rock-chips.com>
First post2016-03-07 05:50 +0100
Last post2016-03-12 00:40 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] PCI/keystone: check return value of devm_phy_get with EPROBE_DEFER Shawn Lin <shawn.lin@rock-chips.com> - 2016-03-07 05:50 +0100
    Re: [PATCH] PCI/keystone: check return value of devm_phy_get with  EPROBE_DEFER Bjorn Helgaas <helgaas@kernel.org> - 2016-03-11 19:40 +0100
      Re: [PATCH] PCI/keystone: check return value of devm_phy_get with  EPROBE_DEFER Bjorn Helgaas <helgaas@kernel.org> - 2016-03-12 00:40 +0100

#1351320 — [PATCH] PCI/keystone: check return value of devm_phy_get with EPROBE_DEFER

FromShawn Lin <shawn.lin@rock-chips.com>
Date2016-03-07 05:50 +0100
Subject[PATCH] PCI/keystone: check return value of devm_phy_get with EPROBE_DEFER
Message-ID<r9Vhg-6vm-3@gated-at.bofh.it>
If the return value of devm_phy_get is EPROBE_DEFER, we should
defer probing the driver.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/pci/host/pci-keystone.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
index 0aa81bd..42af6ac 100644
--- a/drivers/pci/host/pci-keystone.c
+++ b/drivers/pci/host/pci-keystone.c
@@ -363,6 +363,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
 		ret = phy_init(phy);
 		if (ret < 0)
 			return ret;
+	} else if (PTR_ERR(phy) == -EPROBE_DEFER) {
+		return PTR_ERR(phy);
 	}
 
 	/* index 2 is to read PCI DEVICE_ID */
-- 
2.3.7

[toc] | [next] | [standalone]


#1356124 — Re: [PATCH] PCI/keystone: check return value of devm_phy_get with EPROBE_DEFER

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-03-11 19:40 +0100
SubjectRe: [PATCH] PCI/keystone: check return value of devm_phy_get with EPROBE_DEFER
Message-ID<rbA8F-1R9-7@gated-at.bofh.it>
In reply to#1351320
On Mon, Mar 07, 2016 at 12:32:21PM +0800, Shawn Lin wrote:
> If the return value of devm_phy_get is EPROBE_DEFER, we should
> defer probing the driver.
> 
> Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>

Applied to pci/host-keystone for v4.6 with the following changelog.
Thanks, Shawn!

    PCI: keystone: Defer probing if devm_phy_get() returns -EPROBE_DEFER
    
    A SerDes PHY is optional, so if devm_phy_get() doesn't find one at all,
    that's fine.  But if devm_phy_get() finds a PHY that doesn't have a driver
    yet, it returns -EPROBE_DEFER.  In that case, defer probing the Keystone
    driver.  We may be able to load it later after a PHY driver is loaded.
    
    [bhelgaas: changelog]
    Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
> 
>  drivers/pci/host/pci-keystone.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
> index 0aa81bd..42af6ac 100644
> --- a/drivers/pci/host/pci-keystone.c
> +++ b/drivers/pci/host/pci-keystone.c
> @@ -363,6 +363,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
>  		ret = phy_init(phy);
>  		if (ret < 0)
>  			return ret;
> +	} else if (PTR_ERR(phy) == -EPROBE_DEFER) {
> +		return PTR_ERR(phy);
>  	}
>  
>  	/* index 2 is to read PCI DEVICE_ID */
> -- 
> 2.3.7
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [next] | [standalone]


#1356287 — Re: [PATCH] PCI/keystone: check return value of devm_phy_get with EPROBE_DEFER

FromBjorn Helgaas <helgaas@kernel.org>
Date2016-03-12 00:40 +0100
SubjectRe: [PATCH] PCI/keystone: check return value of devm_phy_get with EPROBE_DEFER
Message-ID<rbEP0-5kn-9@gated-at.bofh.it>
In reply to#1356124
On Fri, Mar 11, 2016 at 12:38:23PM -0600, Bjorn Helgaas wrote:
> On Mon, Mar 07, 2016 at 12:32:21PM +0800, Shawn Lin wrote:
> > If the return value of devm_phy_get is EPROBE_DEFER, we should
> > defer probing the driver.
> > 
> > Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
> 
> Applied to pci/host-keystone for v4.6 with the following changelog.
> Thanks, Shawn!
> 
>     PCI: keystone: Defer probing if devm_phy_get() returns -EPROBE_DEFER
>     
>     A SerDes PHY is optional, so if devm_phy_get() doesn't find one at all,
>     that's fine.  But if devm_phy_get() finds a PHY that doesn't have a driver
>     yet, it returns -EPROBE_DEFER.  In that case, defer probing the Keystone
>     driver.  We may be able to load it later after a PHY driver is loaded.
>     
>     [bhelgaas: changelog]
>     Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
>     Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

I meant to include the patch, too, because I tweaked it slightly to
try to make it easier to read.  Here's what I applied:

diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
index 0aa81bd..cd70345 100644
--- a/drivers/pci/host/pci-keystone.c
+++ b/drivers/pci/host/pci-keystone.c
@@ -359,6 +359,9 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
 
 	/* initialize SerDes Phy if present */
 	phy = devm_phy_get(dev, "pcie-phy");
+	if (PTR_ERR_OR_ZERO(phy) == -EPROBE_DEFER)
+		return PTR_ERR(phy);
+
 	if (!IS_ERR_OR_NULL(phy)) {
 		ret = phy_init(phy);
 		if (ret < 0)
> 
> > ---
> > 
> >  drivers/pci/host/pci-keystone.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/pci/host/pci-keystone.c b/drivers/pci/host/pci-keystone.c
> > index 0aa81bd..42af6ac 100644
> > --- a/drivers/pci/host/pci-keystone.c
> > +++ b/drivers/pci/host/pci-keystone.c
> > @@ -363,6 +363,8 @@ static int __init ks_pcie_probe(struct platform_device *pdev)
> >  		ret = phy_init(phy);
> >  		if (ret < 0)
> >  			return ret;
> > +	} else if (PTR_ERR(phy) == -EPROBE_DEFER) {
> > +		return PTR_ERR(phy);
> >  	}
> >  
> >  	/* index 2 is to read PCI DEVICE_ID */
> > -- 
> > 2.3.7
> > 
> > 
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web