[PATCH 1/2] media: rcar-csi2: Fix registering camera endpoint to VIN

From: Lad Prabhakar
Date: Fri Feb 28 2020 - 11:50:20 EST


CSI2 registers camera/sensor as v4l2 async sub device with fwnode is
remote endpoint and the camera/sensor register itself as v4l2 sub device
with fwnode is remote device as a result the match.fwnode should be
fwnode_graph_get_remote_port_parent and not
fwnode_graph_get_remote_endpoint.

This patch makes use of v4l2 helper function
v4l2_async_notifier_add_fwnode_remote_subdev() which uses
fwnode_graph_get_remote_port_parent as match.fwnode fixing the issue
of registering camera endpoint to the driver.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@xxxxxxxxxxxxxx>
---
drivers/media/platform/rcar-vin/rcar-csi2.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-csi2.c b/drivers/media/platform/rcar-vin/rcar-csi2.c
index faa9fb23a2e9..5b04e4768eb1 100644
--- a/drivers/media/platform/rcar-vin/rcar-csi2.c
+++ b/drivers/media/platform/rcar-vin/rcar-csi2.c
@@ -833,20 +833,18 @@ static int rcsi2_parse_dt(struct rcar_csi2 *priv)
return ret;
}

- priv->asd.match.fwnode =
- fwnode_graph_get_remote_endpoint(of_fwnode_handle(ep));
- priv->asd.match_type = V4L2_ASYNC_MATCH_FWNODE;
-
- of_node_put(ep);
-
v4l2_async_notifier_init(&priv->notifier);

- ret = v4l2_async_notifier_add_subdev(&priv->notifier, &priv->asd);
+ ret = v4l2_async_notifier_add_fwnode_remote_subdev(&priv->notifier,
+ of_fwnode_handle(ep),
+ &priv->asd);
if (ret) {
- fwnode_handle_put(priv->asd.match.fwnode);
+ of_node_put(ep);
return ret;
}

+ of_node_put(ep);
+
priv->notifier.ops = &rcar_csi2_notify_ops;

dev_dbg(priv->dev, "Found '%pOF'\n",
--
2.20.1