public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Jai Luthra <jai.luthra@ideasonboard.com>
To: Jai Luthra <jai.luthra@linux.dev>,
	 Mauro Carvalho Chehab <mchehab@kernel.org>,
	 Hans Verkuil <hverkuil@xs4all.nl>,
	 Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
	 Sakari Ailus <sakari.ailus@linux.intel.com>,
	 Maxime Ripard <mripard@kernel.org>
Cc: Devarsh Thakkar <devarsht@ti.com>,
	 Rishikesh Donadkar <r-donadkar@ti.com>,
	Vaishnav Achath <vaishnav.a@ti.com>,
	 Changhuang Liang <changhuang.liang@starfivetech.com>,
	 linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Jai Luthra <jai.luthra@ideasonboard.com>
Subject: [PATCH 2/6] media: ti: j721e-csi2rx: Use fwnode_get_named_child_node
Date: Mon, 24 Mar 2025 17:31:38 +0530	[thread overview]
Message-ID: <20250324-probe_fixes-v1-2-5cd5b9e1cfac@ideasonboard.com> (raw)
In-Reply-To: <20250324-probe_fixes-v1-0-5cd5b9e1cfac@ideasonboard.com>

Simplify notifier registration logic. Instead of first getting the
device node, get the fwnode of the child directly.

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
---
 drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
index a066024bf745450e2ba01d06c0fec4e6bdbfa97e..6d406925e092660cb67c04cc2a7e1e10c14e295e 100644
--- a/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
+++ b/drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/of_platform.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 
 #include <media/mipi-csi2.h>
 #include <media/v4l2-device.h>
@@ -450,25 +451,23 @@ static int ti_csi2rx_notifier_register(struct ti_csi2rx_dev *csi)
 {
 	struct fwnode_handle *fwnode;
 	struct v4l2_async_connection *asc;
-	struct device_node *node;
 	int ret;
 
-	node = of_get_child_by_name(csi->dev->of_node, "csi-bridge");
-	if (!node)
+	fwnode = fwnode_get_named_child_node(csi->dev->fwnode, "csi-bridge");
+	if (!fwnode)
 		return -EINVAL;
 
-	fwnode = of_fwnode_handle(node);
-	if (!fwnode) {
-		of_node_put(node);
-		return -EINVAL;
-	}
-
 	v4l2_async_nf_init(&csi->notifier, &csi->v4l2_dev);
 	csi->notifier.ops = &csi_async_notifier_ops;
 
 	asc = v4l2_async_nf_add_fwnode(&csi->notifier, fwnode,
 				       struct v4l2_async_connection);
-	of_node_put(node);
+	/*
+	 * Calling v4l2_async_nf_add_fwnode grabs a refcount,
+	 * so drop the one we got in fwnode_get_named_child_node
+	 */
+	fwnode_handle_put(fwnode);
+
 	if (IS_ERR(asc)) {
 		v4l2_async_nf_cleanup(&csi->notifier);
 		return PTR_ERR(asc);

-- 
2.48.1


  parent reply	other threads:[~2025-03-24 12:02 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-24 12:01 [PATCH 0/6] media: ti, cdns: Multiple pixel support and misc fixes Jai Luthra
2025-03-24 12:01 ` [PATCH 1/6] media: ti: j721e-csi2rx: Use devm_of_platform_populate Jai Luthra
2025-03-27  6:25   ` Devarsh Thakkar
2025-03-24 12:01 ` Jai Luthra [this message]
2025-03-27  6:31   ` [PATCH 2/6] media: ti: j721e-csi2rx: Use fwnode_get_named_child_node Devarsh Thakkar
2025-03-24 12:01 ` [PATCH 3/6] media: ti: j721e-csi2rx: Fix source subdev link creation Jai Luthra
2025-03-27 10:14   ` Devarsh Thakkar
2025-03-24 12:01 ` [PATCH 4/6] media: cadence: csi2rx: Implement get_fwnode_pad op Jai Luthra
2025-03-27 10:24   ` Devarsh Thakkar
2025-03-28  2:39   ` 回复: " Changhuang Liang
2025-03-24 12:01 ` [PATCH 5/6] media: cadence: cdns-csi2rx: Support multiple pixels per clock cycle Jai Luthra
2025-03-24 14:28   ` kernel test robot
2025-03-24 18:21   ` kernel test robot
2025-03-24 12:01 ` [PATCH 6/6] media: ti: j721e-csi2rx: Support multiple pixels per clock Jai Luthra

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=20250324-probe_fixes-v1-2-5cd5b9e1cfac@ideasonboard.com \
    --to=jai.luthra@ideasonboard.com \
    --cc=changhuang.liang@starfivetech.com \
    --cc=devarsht@ti.com \
    --cc=hverkuil@xs4all.nl \
    --cc=jai.luthra@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mripard@kernel.org \
    --cc=r-donadkar@ti.com \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomi.valkeinen@ideasonboard.com \
    --cc=vaishnav.a@ti.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