lkml.org 
[lkml]   [2014]   [May]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 02/20] usb: ehci-orion: Add the optional PHY support
Dear Andrew Lunn,

On Tue, 6 May 2014 15:33:41 +0200, Andrew Lunn wrote:

> > + priv->phy = devm_phy_get(&pdev->dev, "usb");
> > + if (!IS_ERR(priv->phy)) {
> > + err = phy_init(priv->phy);
> > + if (err)
> > + goto err2;
> > +
> > + err = phy_power_on(priv->phy);
> > + if (err)
> > + goto err3;
> > + }
>
> Hi Gregory
>
> What about EPROBE_DEFERRED?

In v4 (to be submitted soon), I've changed this to:

priv->phy = devm_phy_optional_get(&pdev->dev, "usb");
if (IS_ERR(priv->phy)) {
err = PTR_ERR(priv->phy);
goto err_phy_get;
} else {
err = phy_init(priv->phy);
if (err)
goto err_phy_init;

err = phy_power_on(priv->phy);
if (err)
goto err_phy_power_on;
}

Thanks to devm_phy_optional_get(), the fact of not having a PHY in the
DT is not considered an error. So on any error from
devm_phy_optional_get() (including -EPROBE_DEFER), we simply bail out.
Does this looks good?

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com


\
 
 \ /
  Last update: 2014-05-07 12:01    [W:1.263 / U:0.008 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site