]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
media: rcar-vin: Prepare for unifying all v4l-async notifiers
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Fri, 13 Jun 2025 15:34:27 +0000 (17:34 +0200)
committerHans Verkuil <hverkuil@xs4all.nl>
Mon, 16 Jun 2025 06:52:15 +0000 (08:52 +0200)
The R-Car VIN driver is needlessly complex and uses more then one
v4l-async notifier to attach to all its subdevices. Prepare for unifying
them by moving rvin_parallel_parse_of() to where it needs to be when
they are unified.

The function is moved verbatim and there is no change in behavior.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Tested-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Link: https://lore.kernel.org/r/20250613153434.2001800-7-niklas.soderlund+renesas@ragnatech.se
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
drivers/media/platform/renesas/rcar-vin/rcar-core.c

index 55957dd955767ebcbe771b41ac4ac3e2373da2d0..95621c11eeccab405507cb877f459e52dda08b98 100644 (file)
@@ -338,6 +338,59 @@ static void rvin_group_notifier_cleanup(struct rvin_dev *vin)
        }
 }
 
+static int rvin_parallel_parse_of(struct rvin_dev *vin)
+{
+       struct fwnode_handle *ep, *fwnode;
+       struct v4l2_fwnode_endpoint vep = {
+               .bus_type = V4L2_MBUS_UNKNOWN,
+       };
+       struct v4l2_async_connection *asc;
+       int ret;
+
+       ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(vin->dev), 0, 0, 0);
+       if (!ep)
+               return 0;
+
+       fwnode = fwnode_graph_get_remote_endpoint(ep);
+       ret = v4l2_fwnode_endpoint_parse(ep, &vep);
+       fwnode_handle_put(ep);
+       if (ret) {
+               vin_err(vin, "Failed to parse %pOF\n", to_of_node(fwnode));
+               ret = -EINVAL;
+               goto out;
+       }
+
+       switch (vep.bus_type) {
+       case V4L2_MBUS_PARALLEL:
+       case V4L2_MBUS_BT656:
+               vin_dbg(vin, "Found %s media bus\n",
+                       vep.bus_type == V4L2_MBUS_PARALLEL ?
+                       "PARALLEL" : "BT656");
+               vin->parallel.mbus_type = vep.bus_type;
+               vin->parallel.bus = vep.bus.parallel;
+               break;
+       default:
+               vin_err(vin, "Unknown media bus type\n");
+               ret = -EINVAL;
+               goto out;
+       }
+
+       asc = v4l2_async_nf_add_fwnode(&vin->notifier, fwnode,
+                                      struct v4l2_async_connection);
+       if (IS_ERR(asc)) {
+               ret = PTR_ERR(asc);
+               goto out;
+       }
+
+       vin->parallel.asc = asc;
+
+       vin_dbg(vin, "Add parallel OF device %pOF\n", to_of_node(fwnode));
+out:
+       fwnode_handle_put(fwnode);
+
+       return ret;
+}
+
 static int rvin_group_notifier_init(struct rvin_dev *vin, unsigned int port,
                                    unsigned int max_id)
 {
@@ -636,59 +689,6 @@ static const struct v4l2_async_notifier_operations rvin_parallel_notify_ops = {
        .complete = rvin_parallel_notify_complete,
 };
 
-static int rvin_parallel_parse_of(struct rvin_dev *vin)
-{
-       struct fwnode_handle *ep, *fwnode;
-       struct v4l2_fwnode_endpoint vep = {
-               .bus_type = V4L2_MBUS_UNKNOWN,
-       };
-       struct v4l2_async_connection *asc;
-       int ret;
-
-       ep = fwnode_graph_get_endpoint_by_id(dev_fwnode(vin->dev), 0, 0, 0);
-       if (!ep)
-               return 0;
-
-       fwnode = fwnode_graph_get_remote_endpoint(ep);
-       ret = v4l2_fwnode_endpoint_parse(ep, &vep);
-       fwnode_handle_put(ep);
-       if (ret) {
-               vin_err(vin, "Failed to parse %pOF\n", to_of_node(fwnode));
-               ret = -EINVAL;
-               goto out;
-       }
-
-       switch (vep.bus_type) {
-       case V4L2_MBUS_PARALLEL:
-       case V4L2_MBUS_BT656:
-               vin_dbg(vin, "Found %s media bus\n",
-                       vep.bus_type == V4L2_MBUS_PARALLEL ?
-                       "PARALLEL" : "BT656");
-               vin->parallel.mbus_type = vep.bus_type;
-               vin->parallel.bus = vep.bus.parallel;
-               break;
-       default:
-               vin_err(vin, "Unknown media bus type\n");
-               ret = -EINVAL;
-               goto out;
-       }
-
-       asc = v4l2_async_nf_add_fwnode(&vin->notifier, fwnode,
-                                      struct v4l2_async_connection);
-       if (IS_ERR(asc)) {
-               ret = PTR_ERR(asc);
-               goto out;
-       }
-
-       vin->parallel.asc = asc;
-
-       vin_dbg(vin, "Add parallel OF device %pOF\n", to_of_node(fwnode));
-out:
-       fwnode_handle_put(fwnode);
-
-       return ret;
-}
-
 static void rvin_parallel_cleanup(struct rvin_dev *vin)
 {
        v4l2_async_nf_unregister(&vin->notifier);