Thread (11 messages) 11 messages, 2 authors, 2024-03-25

Re: [PATCH 4/8] media: platform: ti: use for_each_endpoint_of_node()

From: Dan Carpenter <hidden>
Date: 2024-03-25 12:35:07
Also in: dri-devel, linux-arm-kernel, linux-media, linux-omap, linux-staging

On Mon, Mar 25, 2024 at 03:05:27AM +0000, Kuninori Morimoto wrote:
quoted hunk ↗ jump to hunk
We already have for_each_endpoint_of_node(), don't use
of_graph_get_next_endpoint() directly. Replace it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/media/platform/ti/am437x/am437x-vpfe.c   |  8 +++-----
 drivers/media/platform/ti/davinci/vpif_capture.c | 11 +++++------
 2 files changed, 8 insertions(+), 11 deletions(-)
diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
index 77e12457d149..4f185a0d42b3 100644
--- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
@@ -2306,14 +2306,10 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
 	if (!pdata)
 		return NULL;
 
-	for (i = 0; ; i++) {
+	for_each_endpoint_of_node(dev->of_node, endpoint) {
 		struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
 		struct device_node *rem;
 
-		endpoint = of_graph_get_next_endpoint(dev->of_node, endpoint);
-		if (!endpoint)
-			break;
-
 		sdinfo = &pdata->sub_devs[i];
                                          ^
"i" is uninitialized now.

Also in the initializer it has "struct device_node *endpoint = NULL;"
which is unnecessary now.  And at the end it has:

	of_node_put(endpoint);
	return pdata;

Since endpoint is NULL this was always a pointless no-op but now it's
more obvious, so lets delete that.

regards,
dan carpenter
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help