diff mbox series

[v2,6/9] net: ethernet: ti: am65-cpsw: Convert to devm_of_phy_optional_get()

Message ID 3d612c95031cf5c6d5af4ec35f40121288a2c1c6.1674584626.git.geert+renesas@glider.be (mailing list archive)
State New, archived
Headers show
Series phy: Add devm_of_phy_optional_get() helper | expand

Commit Message

Geert Uytterhoeven Jan. 24, 2023, 6:37 p.m. UTC
Use the new devm_of_phy_optional_get() helper instead of open-coding the
same operation.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
  - Rebase on top of commit 854617f52ab42418 ("net: ethernet: ti:
    am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY") in net-next
    (next-20230123 and later).
---
 drivers/net/ethernet/ti/am65-cpsw-nuss.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Siddharth Vadapalli Jan. 25, 2023, 5:13 a.m. UTC | #1
On 25/01/23 00:07, Geert Uytterhoeven wrote:
> Use the new devm_of_phy_optional_get() helper instead of open-coding the
> same operation.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v2:
>   - Rebase on top of commit 854617f52ab42418 ("net: ethernet: ti:
>     am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY") in net-next
>     (next-20230123 and later).
> ---
>  drivers/net/ethernet/ti/am65-cpsw-nuss.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> index c696da89962f1ae3..794f228c8d632f7a 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> @@ -1460,11 +1460,9 @@ static int am65_cpsw_init_serdes_phy(struct device *dev, struct device_node *por
>  	struct phy *phy;
>  	int ret;
>  
> -	phy = devm_of_phy_get(dev, port_np, name);
> -	if (PTR_ERR(phy) == -ENODEV)
> -		return 0;
> -	if (IS_ERR(phy))
> -		return PTR_ERR(phy);
> +	phy = devm_of_phy_optional_get(dev, port_np, name);
> +	if (IS_ERR_OR_NULL(phy))
> +		return PTR_ERR_OR_ZERO(phy);

Reviewed-by: Siddharth Vadapalli <s-vadapalli@ti.com>

Regards,
Siddharth.
Vinod Koul Feb. 3, 2023, 5:27 a.m. UTC | #2
On 24-01-23, 19:37, Geert Uytterhoeven wrote:
> Use the new devm_of_phy_optional_get() helper instead of open-coding the
> same operation.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> v2:
>   - Rebase on top of commit 854617f52ab42418 ("net: ethernet: ti:
>     am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY") in net-next
>     (next-20230123 and later).

I was trying to apply this on rc1, so ofcourse this fails for me? How do
we resolve this?

I can skip this patch, provide a tag for this to be pulled into -net
tree

> ---
>  drivers/net/ethernet/ti/am65-cpsw-nuss.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> index c696da89962f1ae3..794f228c8d632f7a 100644
> --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> @@ -1460,11 +1460,9 @@ static int am65_cpsw_init_serdes_phy(struct device *dev, struct device_node *por
>  	struct phy *phy;
>  	int ret;
>  
> -	phy = devm_of_phy_get(dev, port_np, name);
> -	if (PTR_ERR(phy) == -ENODEV)
> -		return 0;
> -	if (IS_ERR(phy))
> -		return PTR_ERR(phy);
> +	phy = devm_of_phy_optional_get(dev, port_np, name);
> +	if (IS_ERR_OR_NULL(phy))
> +		return PTR_ERR_OR_ZERO(phy);
>  
>  	/* Serdes PHY exists. Store it. */
>  	port->slave.serdes_phy = phy;
> -- 
> 2.34.1
Geert Uytterhoeven Feb. 3, 2023, 8:04 a.m. UTC | #3
Hi Vinod,

On Fri, Feb 3, 2023 at 6:27 AM Vinod Koul <vkoul@kernel.org> wrote:
> On 24-01-23, 19:37, Geert Uytterhoeven wrote:
> > Use the new devm_of_phy_optional_get() helper instead of open-coding the
> > same operation.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > v2:
> >   - Rebase on top of commit 854617f52ab42418 ("net: ethernet: ti:
> >     am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY") in net-next
> >     (next-20230123 and later).
>
> I was trying to apply this on rc1, so ofcourse this fails for me? How do
> we resolve this?
>
> I can skip this patch, provide a tag for this to be pulled into -net
> tree

Thanks, that's one option.
The other option is to postpone this patch, and apply it after v6.3-rc1.

Thanks!

> > --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> > +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
> > @@ -1460,11 +1460,9 @@ static int am65_cpsw_init_serdes_phy(struct device *dev, struct device_node *por
> >       struct phy *phy;
> >       int ret;
> >
> > -     phy = devm_of_phy_get(dev, port_np, name);
> > -     if (PTR_ERR(phy) == -ENODEV)
> > -             return 0;
> > -     if (IS_ERR(phy))
> > -             return PTR_ERR(phy);
> > +     phy = devm_of_phy_optional_get(dev, port_np, name);
> > +     if (IS_ERR_OR_NULL(phy))
> > +             return PTR_ERR_OR_ZERO(phy);
> >
> >       /* Serdes PHY exists. Store it. */
> >       port->slave.serdes_phy = phy;

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Vinod Koul Feb. 3, 2023, 9:58 a.m. UTC | #4
On 03-02-23, 09:04, Geert Uytterhoeven wrote:
> Hi Vinod,
> 
> On Fri, Feb 3, 2023 at 6:27 AM Vinod Koul <vkoul@kernel.org> wrote:
> > On 24-01-23, 19:37, Geert Uytterhoeven wrote:
> > > Use the new devm_of_phy_optional_get() helper instead of open-coding the
> > > same operation.
> > >
> > > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > > ---
> > > v2:
> > >   - Rebase on top of commit 854617f52ab42418 ("net: ethernet: ti:
> > >     am65-cpsw: Handle -EPROBE_DEFER for Serdes PHY") in net-next
> > >     (next-20230123 and later).
> >
> > I was trying to apply this on rc1, so ofcourse this fails for me? How do
> > we resolve this?
> >
> > I can skip this patch, provide a tag for this to be pulled into -net
> > tree
> 
> Thanks, that's one option.
> The other option is to postpone this patch, and apply it after v6.3-rc1.

Okay, done
diff mbox series

Patch

diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
index c696da89962f1ae3..794f228c8d632f7a 100644
--- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c
+++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c
@@ -1460,11 +1460,9 @@  static int am65_cpsw_init_serdes_phy(struct device *dev, struct device_node *por
 	struct phy *phy;
 	int ret;
 
-	phy = devm_of_phy_get(dev, port_np, name);
-	if (PTR_ERR(phy) == -ENODEV)
-		return 0;
-	if (IS_ERR(phy))
-		return PTR_ERR(phy);
+	phy = devm_of_phy_optional_get(dev, port_np, name);
+	if (IS_ERR_OR_NULL(phy))
+		return PTR_ERR_OR_ZERO(phy);
 
 	/* Serdes PHY exists. Store it. */
 	port->slave.serdes_phy = phy;