Linux CAN drivers development
 help / color / mirror / Atom feed
From: Biju Das <biju.das.jz@bp.renesas.com>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
	Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Cc: "Biju Das" <biju.das.jz@bp.renesas.com>,
	"Geert Uytterhoeven" <geert+renesas@glider.be>,
	"Wolfram Sang" <wsa+renesas@sang-engineering.com>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>,
	"Rob Herring" <robh@kernel.org>,
	"Ulrich Hecht" <ulrich.hecht+renesas@gmail.com>,
	linux-can@vger.kernel.org,
	"Prabhakar Mahadev Lad" <prabhakar.mahadev-lad.rj@bp.renesas.com>,
	"Biju Das" <biju.das.au@gmail.com>,
	linux-renesas-soc@vger.kernel.org
Subject: [PATCH v4 03/11] can: rcar_canfd: Use of_get_available_child_by_name()
Date: Thu,  6 Mar 2025 12:42:42 +0000	[thread overview]
Message-ID: <20250306124256.93033-4-biju.das.jz@bp.renesas.com> (raw)
In-Reply-To: <20250306124256.93033-1-biju.das.jz@bp.renesas.com>

Simplify rcar_canfd_probe() using of_get_available_child_by_name().

While at it, move of_node_put(child) inside the if block to avoid
additional check if of_child is NULL.

Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v3->v4:
 * No change.
v2->v3:
 * Added Rb tag from Geert.
v2:
 * Added to this series as dependency patch hit on can-next.
 * Added Rb tag from Vincent Mailhol
 * Dropped redundant comment from commit description.
---
 drivers/net/can/rcar/rcar_canfd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/rcar/rcar_canfd.c b/drivers/net/can/rcar/rcar_canfd.c
index 270f50d836f5..8b326977ddf7 100644
--- a/drivers/net/can/rcar/rcar_canfd.c
+++ b/drivers/net/can/rcar/rcar_canfd.c
@@ -1864,13 +1864,13 @@ static int rcar_canfd_probe(struct platform_device *pdev)
 
 	for (i = 0; i < info->max_channels; ++i) {
 		name[7] = '0' + i;
-		of_child = of_get_child_by_name(dev->of_node, name);
-		if (of_child && of_device_is_available(of_child)) {
+		of_child = of_get_available_child_by_name(dev->of_node, name);
+		if (of_child) {
 			channels_mask |= BIT(i);
 			transceivers[i] = devm_of_phy_optional_get(dev,
 							of_child, NULL);
+			of_node_put(of_child);
 		}
-		of_node_put(of_child);
 		if (IS_ERR(transceivers[i]))
 			return PTR_ERR(transceivers[i]);
 	}
-- 
2.43.0


  parent reply	other threads:[~2025-03-06 12:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-06 12:42 [PATCH v4 00/11] Add support for RZ/G3E CANFD Biju Das
2025-03-06 12:42 ` [PATCH v4 01/11] dt-bindings: can: renesas,rcar-canfd: Simplify the conditional schema Biju Das
2025-03-14 13:31   ` Geert Uytterhoeven
2025-03-14 13:53     ` Biju Das
2025-03-06 12:42 ` [PATCH v4 02/11] dt-bindings: can: renesas,rcar-canfd: Document RZ/G3E support Biju Das
2025-03-14 13:40   ` Geert Uytterhoeven
2025-03-14 13:59     ` Biju Das
2025-03-06 12:42 ` Biju Das [this message]
2025-03-06 12:42 ` [PATCH v4 04/11] can: rcar_canfd: Add ch_interface_mode variable to struct rcar_canfd_hw_info Biju Das
2025-03-14 14:45   ` Geert Uytterhoeven
2025-03-06 12:42 ` [PATCH v4 05/11] can: rcar_canfd: Add shared_can_regs " Biju Das
2025-03-14 14:46   ` Geert Uytterhoeven
2025-03-15 17:25     ` Biju Das
2025-03-06 12:42 ` [PATCH v4 06/11] can: rcar_canfd: Add register mapping table " Biju Das
2025-03-14 14:46   ` Geert Uytterhoeven
2025-03-15 17:26     ` Biju Das
2025-03-06 12:42 ` [PATCH v4 07/11] can: rcar_canfd: Add mask " Biju Das
2025-03-14 14:47   ` Geert Uytterhoeven
2025-03-15 17:29     ` Biju Das
2025-03-06 12:42 ` [PATCH v4 08/11] can: rcar_canfd: Add shift " Biju Das
2025-03-14 14:47   ` Geert Uytterhoeven
2025-03-14 18:39     ` Biju Das
2025-03-15 17:31     ` Biju Das
2025-03-16  9:53       ` Geert Uytterhoeven
2025-03-16 17:02         ` Biju Das
2025-03-17  9:53           ` Geert Uytterhoeven
2025-03-17  9:58             ` Biju Das
2025-03-06 12:42 ` [PATCH v4 09/11] can: rcar_canfd: Add only_internal_clks variable " Biju Das
2025-03-14 14:47   ` Geert Uytterhoeven
2025-03-15 17:33     ` Biju Das
2025-03-16  9:50       ` Geert Uytterhoeven
2025-03-06 12:42 ` [PATCH v4 10/11] can: rcar_canfd: Enhance multi_channel_irqs handling Biju Das
2025-03-14 14:47   ` Geert Uytterhoeven
2025-03-06 12:42 ` [PATCH v4 11/11] can: rcar_canfd: Add RZ/G3E support Biju Das
2025-03-14 14:48   ` Geert Uytterhoeven
2025-03-14 14:59     ` Biju Das
2025-03-14 15:12       ` Geert Uytterhoeven
2025-03-14 12:38 ` [PATCH v4 00/11] Add support for RZ/G3E CANFD Marc Kleine-Budde
2025-03-14 12:51   ` Biju Das

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250306124256.93033-4-biju.das.jz@bp.renesas.com \
    --to=biju.das.jz@bp.renesas.com \
    --cc=biju.das.au@gmail.com \
    --cc=geert+renesas@glider.be \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=mailhol.vincent@wanadoo.fr \
    --cc=mkl@pengutronix.de \
    --cc=prabhakar.mahadev-lad.rj@bp.renesas.com \
    --cc=robh@kernel.org \
    --cc=u.kleine-koenig@baylibre.com \
    --cc=ulrich.hecht+renesas@gmail.com \
    --cc=wsa+renesas@sang-engineering.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox