]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
media: ti: j721e-csi2rx: Use fwnode_get_named_child_node
authorJai Luthra <jai.luthra@ideasonboard.com>
Mon, 11 Aug 2025 08:20:14 +0000 (13:50 +0530)
committerHans Verkuil <hverkuil+cisco@kernel.org>
Mon, 25 Aug 2025 13:40:41 +0000 (15:40 +0200)
Simplify notifier registration logic. Instead of first getting the
device node, get the fwnode of the child directly.

Reviewed-by: Devarsh Thakkar <devarsht@ti.com>
Tested-by: Yemike Abhilash Chandra <y-abhilashchandra@ti.com> (on SK-AM68)
Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
drivers/media/platform/ti/j721e-csi2rx/j721e-csi2rx.c

index aa5db8f25c4a352d41750eec1aa6ccd644fd7dc9..cad873b48c20885dc6c2333c92ea0bb1bf8a0268 100644 (file)
@@ -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);