diff mbox series

net: dsa: rzn1_a5psw: Use of_get_available_child_by_name()

Message ID 20250201163345.49779-1-biju.das.jz@bp.renesas.com (mailing list archive)
State New
Delegated to: Geert Uytterhoeven
Headers show
Series net: dsa: rzn1_a5psw: Use of_get_available_child_by_name() | expand

Commit Message

Biju Das Feb. 1, 2025, 4:33 p.m. UTC
Simplify a5psw_probe() by using of_get_available_child_by_name().

While at it, move of_node_put(mdio) inside the if block to avoid
code duplication.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
This patch is only compile tested and depend upon[1]
[1] https://lore.kernel.org/all/20250201093126.7322-1-biju.das.jz@bp.renesas.com/
---
 drivers/net/dsa/rzn1_a5psw.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Andrew Lunn Feb. 1, 2025, 6:42 p.m. UTC | #1
On Sat, Feb 01, 2025 at 04:33:43PM +0000, Biju Das wrote:
> Simplify a5psw_probe() by using of_get_available_child_by_name().
> 
> While at it, move of_node_put(mdio) inside the if block to avoid
> code duplication.
> 
> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> ---
> This patch is only compile tested and depend upon[1]
> [1] https://lore.kernel.org/all/20250201093126.7322-1-biju.das.jz@bp.renesas.com/

It would be good to point out the status of this patch. Will it be in -rc1?

Since netdev is closed at the moment because of the merge window, you
need to repost anyway, once it repopen. The tree you will be basing
your patch on, net-next, will include -rc1, so you won't need to
mention the dependency.

https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

    Andrew

---
pw-bot: cr
Biju Das Feb. 2, 2025, 10:18 a.m. UTC | #2
Hi Andrew,

Thanks for the feedback.

> -----Original Message-----
> From: Andrew Lunn <andrew@lunn.ch>
> Sent: 01 February 2025 18:42
> To: Biju Das <biju.das.jz@bp.renesas.com>
> Subject: Re: [PATCH] net: dsa: rzn1_a5psw: Use of_get_available_child_by_name()
> 
> On Sat, Feb 01, 2025 at 04:33:43PM +0000, Biju Das wrote:
> > Simplify a5psw_probe() by using of_get_available_child_by_name().
> >
> > While at it, move of_node_put(mdio) inside the if block to avoid code
> > duplication.
> >
> > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
> > ---
> > This patch is only compile tested and depend upon[1] [1]
> > https://lore.kernel.org/all/20250201093126.7322-1-biju.das.jz@bp.renes
> > as.com/
> 
> It would be good to point out the status of this patch. Will it be in -rc1?
> 
> Since netdev is closed at the moment because of the merge window, you need to repost anyway, once it
> repopen. The tree you will be basing your patch on, net-next, will include -rc1, so you won't need to
> mention the dependency.
> 
> https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html

Thanks. I will send next version once the dependency patch hits on net-next.

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/net/dsa/rzn1_a5psw.c b/drivers/net/dsa/rzn1_a5psw.c
index 66974379334a..31ea8130a495 100644
--- a/drivers/net/dsa/rzn1_a5psw.c
+++ b/drivers/net/dsa/rzn1_a5psw.c
@@ -1248,18 +1248,16 @@  static int a5psw_probe(struct platform_device *pdev)
 	if (ret)
 		goto clk_disable;
 
-	mdio = of_get_child_by_name(dev->of_node, "mdio");
-	if (of_device_is_available(mdio)) {
+	mdio = of_get_available_child_by_name(dev->of_node, "mdio");
+	if (mdio) {
 		ret = a5psw_probe_mdio(a5psw, mdio);
+		of_node_put(mdio);
 		if (ret) {
-			of_node_put(mdio);
 			dev_err(dev, "Failed to register MDIO: %d\n", ret);
 			goto hclk_disable;
 		}
 	}
 
-	of_node_put(mdio);
-
 	ds = &a5psw->ds;
 	ds->dev = dev;
 	ds->num_ports = A5PSW_PORTS_NUM;