diff mbox series

[v6,6/6] PCI: uniphier: Add error message when failed to get phy

Message ID 1596795922-705-7-git-send-email-hayashi.kunihiko@socionext.com
State New
Headers show
Series PCI: uniphier: Add features for UniPhier PCIe host controller | expand

Commit Message

Kunihiko Hayashi Aug. 7, 2020, 10:25 a.m. UTC
Even if phy driver doesn't probe, the error message can't be distinguished
from other errors. This displays error message caused by the phy driver
explicitly.

Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

---
 drivers/pci/controller/dwc/pcie-uniphier.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

-- 
2.7.4

Comments

Rob Herring Aug. 17, 2020, 4:39 p.m. UTC | #1
On Fri, Aug 7, 2020 at 4:25 AM Kunihiko Hayashi
<hayashi.kunihiko@socionext.com> wrote:
>

> Even if phy driver doesn't probe, the error message can't be distinguished

> from other errors. This displays error message caused by the phy driver

> explicitly.

>

> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

> ---

>  drivers/pci/controller/dwc/pcie-uniphier.c | 8 ++++++--

>  1 file changed, 6 insertions(+), 2 deletions(-)

>

> diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c

> index 93ef608..7c8721e 100644

> --- a/drivers/pci/controller/dwc/pcie-uniphier.c

> +++ b/drivers/pci/controller/dwc/pcie-uniphier.c

> @@ -489,8 +489,12 @@ static int uniphier_pcie_probe(struct platform_device *pdev)

>                 return PTR_ERR(priv->rst);

>

>         priv->phy = devm_phy_optional_get(dev, "pcie-phy");


The point of the optional variant vs. devm_phy_get() is whether or not
you get an error message. So shouldn't you switch to devm_phy_get
instead?

> -       if (IS_ERR(priv->phy))

> -               return PTR_ERR(priv->phy);

> +       if (IS_ERR(priv->phy)) {

> +               ret = PTR_ERR(priv->phy);

> +               if (ret != -EPROBE_DEFER)

> +                       dev_err(dev, "Failed to get phy (%d)\n", ret);

> +               return ret;

> +       }

>

>         platform_set_drvdata(pdev, priv);

>

> --

> 2.7.4

>
Kunihiko Hayashi Aug. 21, 2020, 7:05 a.m. UTC | #2
On 2020/08/18 1:39, Rob Herring wrote:
> On Fri, Aug 7, 2020 at 4:25 AM Kunihiko Hayashi

> <hayashi.kunihiko@socionext.com> wrote:

>>

>> Even if phy driver doesn't probe, the error message can't be distinguished

>> from other errors. This displays error message caused by the phy driver

>> explicitly.

>>

>> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

>> ---

>>   drivers/pci/controller/dwc/pcie-uniphier.c | 8 ++++++--

>>   1 file changed, 6 insertions(+), 2 deletions(-)

>>

>> diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c

>> index 93ef608..7c8721e 100644

>> --- a/drivers/pci/controller/dwc/pcie-uniphier.c

>> +++ b/drivers/pci/controller/dwc/pcie-uniphier.c

>> @@ -489,8 +489,12 @@ static int uniphier_pcie_probe(struct platform_device *pdev)

>>                  return PTR_ERR(priv->rst);

>>

>>          priv->phy = devm_phy_optional_get(dev, "pcie-phy");

> 

> The point of the optional variant vs. devm_phy_get() is whether or not

> you get an error message. So shouldn't you switch to devm_phy_get

> instead?

> 

>> -       if (IS_ERR(priv->phy))

>> -               return PTR_ERR(priv->phy);

>> +       if (IS_ERR(priv->phy)) {

>> +               ret = PTR_ERR(priv->phy);

>> +               if (ret != -EPROBE_DEFER)

>> +                       dev_err(dev, "Failed to get phy (%d)\n", ret);

>> +               return ret;

>> +       }


The 'phys' property is optional, so if there isn't 'phys' in the PCIe node,
devm_phy_get() returns -ENODEV, and devm_phy_optional_get() returns NULL.

When devm_phy_optional_get() replaces devm_phy_get(),
condition for displaying an error message changes to:

    (ret != -EPROBE_DEFER && ret != -ENODEV)

This won't be simple, but should it be replaced?

Thank you,

---
Best Regards
Kunihiko Hayashi
Rob Herring Sept. 3, 2020, 10:25 p.m. UTC | #3
On Fri, Aug 21, 2020 at 1:05 AM Kunihiko Hayashi
<hayashi.kunihiko@socionext.com> wrote:
>

> On 2020/08/18 1:39, Rob Herring wrote:

> > On Fri, Aug 7, 2020 at 4:25 AM Kunihiko Hayashi

> > <hayashi.kunihiko@socionext.com> wrote:

> >>

> >> Even if phy driver doesn't probe, the error message can't be distinguished

> >> from other errors. This displays error message caused by the phy driver

> >> explicitly.

> >>

> >> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

> >> ---

> >>   drivers/pci/controller/dwc/pcie-uniphier.c | 8 ++++++--

> >>   1 file changed, 6 insertions(+), 2 deletions(-)

> >>

> >> diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c

> >> index 93ef608..7c8721e 100644

> >> --- a/drivers/pci/controller/dwc/pcie-uniphier.c

> >> +++ b/drivers/pci/controller/dwc/pcie-uniphier.c

> >> @@ -489,8 +489,12 @@ static int uniphier_pcie_probe(struct platform_device *pdev)

> >>                  return PTR_ERR(priv->rst);

> >>

> >>          priv->phy = devm_phy_optional_get(dev, "pcie-phy");

> >

> > The point of the optional variant vs. devm_phy_get() is whether or not

> > you get an error message. So shouldn't you switch to devm_phy_get

> > instead?

> >

> >> -       if (IS_ERR(priv->phy))

> >> -               return PTR_ERR(priv->phy);

> >> +       if (IS_ERR(priv->phy)) {

> >> +               ret = PTR_ERR(priv->phy);

> >> +               if (ret != -EPROBE_DEFER)

> >> +                       dev_err(dev, "Failed to get phy (%d)\n", ret);

> >> +               return ret;

> >> +       }

>

> The 'phys' property is optional, so if there isn't 'phys' in the PCIe node,

> devm_phy_get() returns -ENODEV, and devm_phy_optional_get() returns NULL.

>

> When devm_phy_optional_get() replaces devm_phy_get(),

> condition for displaying an error message changes to:

>

>     (ret != -EPROBE_DEFER && ret != -ENODEV)

>

> This won't be simple, but should it be replaced?


Nevermind. I was thinking we had some error prints for the optional
vs. non-optional variants.

Rob
Kunihiko Hayashi Sept. 7, 2020, 4:09 p.m. UTC | #4
Hi Rob,

On 2020/09/04 7:25, Rob Herring wrote:
> On Fri, Aug 21, 2020 at 1:05 AM Kunihiko Hayashi

> <hayashi.kunihiko@socionext.com> wrote:

>>

>> On 2020/08/18 1:39, Rob Herring wrote:

>>> On Fri, Aug 7, 2020 at 4:25 AM Kunihiko Hayashi

>>> <hayashi.kunihiko@socionext.com> wrote:

>>>>

>>>> Even if phy driver doesn't probe, the error message can't be distinguished

>>>> from other errors. This displays error message caused by the phy driver

>>>> explicitly.

>>>>

>>>> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

>>>> ---

>>>>    drivers/pci/controller/dwc/pcie-uniphier.c | 8 ++++++--

>>>>    1 file changed, 6 insertions(+), 2 deletions(-)

>>>>

>>>> diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c

>>>> index 93ef608..7c8721e 100644

>>>> --- a/drivers/pci/controller/dwc/pcie-uniphier.c

>>>> +++ b/drivers/pci/controller/dwc/pcie-uniphier.c

>>>> @@ -489,8 +489,12 @@ static int uniphier_pcie_probe(struct platform_device *pdev)

>>>>                   return PTR_ERR(priv->rst);

>>>>

>>>>           priv->phy = devm_phy_optional_get(dev, "pcie-phy");

>>>

>>> The point of the optional variant vs. devm_phy_get() is whether or not

>>> you get an error message. So shouldn't you switch to devm_phy_get

>>> instead?

>>>

>>>> -       if (IS_ERR(priv->phy))

>>>> -               return PTR_ERR(priv->phy);

>>>> +       if (IS_ERR(priv->phy)) {

>>>> +               ret = PTR_ERR(priv->phy);

>>>> +               if (ret != -EPROBE_DEFER)

>>>> +                       dev_err(dev, "Failed to get phy (%d)\n", ret);

>>>> +               return ret;

>>>> +       }

>>

>> The 'phys' property is optional, so if there isn't 'phys' in the PCIe node,

>> devm_phy_get() returns -ENODEV, and devm_phy_optional_get() returns NULL.

>>

>> When devm_phy_optional_get() replaces devm_phy_get(),

>> condition for displaying an error message changes to:

>>

>>      (ret != -EPROBE_DEFER && ret != -ENODEV)

>>

>> This won't be simple, but should it be replaced?

> 

> Nevermind. I was thinking we had some error prints for the optional

> vs. non-optional variants.

I understand.
As long as this phy is "optional", this doesn't need to print error message.
Once I cancel this patch, and leave the phy as "optional".

Thank you,

---
Best Regards
Kunihiko Hayashi
Rob Herring (Arm) Sept. 10, 2020, 6:24 p.m. UTC | #5
On Fri, 07 Aug 2020 19:25:22 +0900, Kunihiko Hayashi wrote:
> Even if phy driver doesn't probe, the error message can't be distinguished

> from other errors. This displays error message caused by the phy driver

> explicitly.

> 

> Signed-off-by: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>

> ---

>  drivers/pci/controller/dwc/pcie-uniphier.c | 8 ++++++--

>  1 file changed, 6 insertions(+), 2 deletions(-)

> 


Reviewed-by: Rob Herring <robh@kernel.org>
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-uniphier.c b/drivers/pci/controller/dwc/pcie-uniphier.c
index 93ef608..7c8721e 100644
--- a/drivers/pci/controller/dwc/pcie-uniphier.c
+++ b/drivers/pci/controller/dwc/pcie-uniphier.c
@@ -489,8 +489,12 @@  static int uniphier_pcie_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->rst);
 
 	priv->phy = devm_phy_optional_get(dev, "pcie-phy");
-	if (IS_ERR(priv->phy))
-		return PTR_ERR(priv->phy);
+	if (IS_ERR(priv->phy)) {
+		ret = PTR_ERR(priv->phy);
+		if (ret != -EPROBE_DEFER)
+			dev_err(dev, "Failed to get phy (%d)\n", ret);
+		return ret;
+	}
 
 	platform_set_drvdata(pdev, priv);