All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] use for_each_endpoint_of_node()
@ 2024-03-25  3:04 ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:04 UTC (permalink / raw)
  To: Lad, Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-om, ap,
	linux-staging


Hi Rob, Helge

We already have for_each_endpoint_of_node(), but some drivers are
not using it. This patch-set replace it.

This patch-set is related to "OF" (= Rob), but many driveres are for
"MultiMedia" (= Helge). I'm not sure who can handle it.

[o] done
[x] under reviewing
[*] this patch-set

	[o] tidyup of_graph_get_endpoint_count()
	[x] replace endpoint func - use endpoint_by_regs()
	[*] replace endpoint func - use for_each()
	[ ] rename endpoint func to device_endpoint
	[ ] add new port function
	[ ] add new endpont function
	[ ] remove of_graph_get_next_device_endpoint()

Kuninori Morimoto (8):
  gpu: drm: use for_each_endpoint_of_node()
  hwtracing: use for_each_endpoint_of_node()
  media: platform: microchip: use for_each_endpoint_of_node()
  media: platform: ti: use for_each_endpoint_of_node()
  media: platform: xilinx: use for_each_endpoint_of_node()
  staging: media: atmel: use for_each_endpoint_of_node()
  video: fbdev: use for_each_endpoint_of_node()
  fbdev: omapfb: use of_graph_get_remote_port()

 drivers/gpu/drm/omapdrm/dss/base.c            |  3 +--
 .../hwtracing/coresight/coresight-platform.c  |  4 ++--
 .../microchip/microchip-sama5d2-isc.c         | 19 +++++++------------
 .../microchip/microchip-sama7g5-isc.c         | 19 +++++++------------
 .../media/platform/ti/am437x/am437x-vpfe.c    |  8 +++-----
 .../media/platform/ti/davinci/vpif_capture.c  | 11 +++++------
 drivers/media/platform/xilinx/xilinx-vipp.c   |  7 +------
 .../deprecated/atmel/atmel-sama5d2-isc.c      |  6 +-----
 .../deprecated/atmel/atmel-sama7g5-isc.c      |  6 +-----
 drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 15 +--------------
 .../omap2/omapfb/dss/omapdss-boot-init.c      |  3 +--
 11 files changed, 30 insertions(+), 71 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 0/8] use for_each_endpoint_of_node()
@ 2024-03-25  3:04 ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:04 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-om


Hi Rob, Helge

We already have for_each_endpoint_of_node(), but some drivers are
not using it. This patch-set replace it.

This patch-set is related to "OF" (= Rob), but many driveres are for
"MultiMedia" (= Helge). I'm not sure who can handle it.

[o] done
[x] under reviewing
[*] this patch-set

	[o] tidyup of_graph_get_endpoint_count()
	[x] replace endpoint func - use endpoint_by_regs()
	[*] replace endpoint func - use for_each()
	[ ] rename endpoint func to device_endpoint
	[ ] add new port function
	[ ] add new endpont function
	[ ] remove of_graph_get_next_device_endpoint()

Kuninori Morimoto (8):
  gpu: drm: use for_each_endpoint_of_node()
  hwtracing: use for_each_endpoint_of_node()
  media: platform: microchip: use for_each_endpoint_of_node()
  media: platform: ti: use for_each_endpoint_of_node()
  media: platform: xilinx: use for_each_endpoint_of_node()
  staging: media: atmel: use for_each_endpoint_of_node()
  video: fbdev: use for_each_endpoint_of_node()
  fbdev: omapfb: use of_graph_get_remote_port()

 drivers/gpu/drm/omapdrm/dss/base.c            |  3 +--
 .../hwtracing/coresight/coresight-platform.c  |  4 ++--
 .../microchip/microchip-sama5d2-isc.c         | 19 +++++++------------
 .../microchip/microchip-sama7g5-isc.c         | 19 +++++++------------
 .../media/platform/ti/am437x/am437x-vpfe.c    |  8 +++-----
 .../media/platform/ti/davinci/vpif_capture.c  | 11 +++++------
 drivers/media/platform/xilinx/xilinx-vipp.c   |  7 +------
 .../deprecated/atmel/atmel-sama5d2-isc.c      |  6 +-----
 .../deprecated/atmel/atmel-sama7g5-isc.c      |  6 +-----
 drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 15 +--------------
 .../omap2/omapfb/dss/omapdss-boot-init.c      |  3 +--
 11 files changed, 30 insertions(+), 71 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/8] gpu: drm: use for_each_endpoint_of_node()
  2024-03-25  3:04 ` Kuninori Morimoto
@ 2024-03-25  3:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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/gpu/drm/omapdrm/dss/base.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 050ca7eafac5..5f8002f6bb7a 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -242,8 +242,7 @@ static void omapdss_walk_device(struct device *dev, struct device_node *node,
 
 	of_node_put(n);
 
-	n = NULL;
-	while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
+	for_each_endpoint_of_node(node, n) {
 		struct device_node *pn = of_graph_get_remote_port_parent(n);
 
 		if (!pn)
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 1/8] gpu: drm: use for_each_endpoint_of_node()
@ 2024-03-25  3:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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/gpu/drm/omapdrm/dss/base.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/omapdrm/dss/base.c b/drivers/gpu/drm/omapdrm/dss/base.c
index 050ca7eafac5..5f8002f6bb7a 100644
--- a/drivers/gpu/drm/omapdrm/dss/base.c
+++ b/drivers/gpu/drm/omapdrm/dss/base.c
@@ -242,8 +242,7 @@ static void omapdss_walk_device(struct device *dev, struct device_node *node,
 
 	of_node_put(n);
 
-	n = NULL;
-	while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
+	for_each_endpoint_of_node(node, n) {
 		struct device_node *pn = of_graph_get_remote_port_parent(n);
 
 		if (!pn)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/8] hwtracing: use for_each_endpoint_of_node()
  2024-03-25  3:04 ` Kuninori Morimoto
@ 2024-03-25  3:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 9d550f5697fa..e9683e613d52 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -275,7 +275,7 @@ static int of_get_coresight_platform_data(struct device *dev,
 	 */
 	if (!parent) {
 		/*
-		 * Avoid warnings in of_graph_get_next_endpoint()
+		 * Avoid warnings in for_each_endpoint_of_node()
 		 * if the device doesn't have any graph connections
 		 */
 		if (!of_graph_is_present(node))
@@ -286,7 +286,7 @@ static int of_get_coresight_platform_data(struct device *dev,
 	}
 
 	/* Iterate through each output port to discover topology */
-	while ((ep = of_graph_get_next_endpoint(parent, ep))) {
+	for_each_endpoint_of_node(parent, ep) {
 		/*
 		 * Legacy binding mixes input/output ports under the
 		 * same parent. So, skip the input ports if we are dealing
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 2/8] hwtracing: use for_each_endpoint_of_node()
@ 2024-03-25  3:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@arm.com>
---
 drivers/hwtracing/coresight/coresight-platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 9d550f5697fa..e9683e613d52 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -275,7 +275,7 @@ static int of_get_coresight_platform_data(struct device *dev,
 	 */
 	if (!parent) {
 		/*
-		 * Avoid warnings in of_graph_get_next_endpoint()
+		 * Avoid warnings in for_each_endpoint_of_node()
 		 * if the device doesn't have any graph connections
 		 */
 		if (!of_graph_is_present(node))
@@ -286,7 +286,7 @@ static int of_get_coresight_platform_data(struct device *dev,
 	}
 
 	/* Iterate through each output port to discover topology */
-	while ((ep = of_graph_get_next_endpoint(parent, ep))) {
+	for_each_endpoint_of_node(parent, ep) {
 		/*
 		 * Legacy binding mixes input/output ports under the
 		 * same parent. So, skip the input ports if we are dealing
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/8] media: platform: microchip: use for_each_endpoint_of_node()
  2024-03-25  3:04 ` Kuninori Morimoto
@ 2024-03-25  3:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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>
---
 .../microchip/microchip-sama5d2-isc.c         | 19 +++++++------------
 .../microchip/microchip-sama7g5-isc.c         | 19 +++++++------------
 2 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index 5ac149cf3647..d9298771f509 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -356,30 +356,26 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
 	struct device_node *epn = NULL;
 	struct isc_subdev_entity *subdev_entity;
 	unsigned int flags;
-	int ret;
 
 	INIT_LIST_HEAD(&isc->subdev_entities);
 
-	while (1) {
+	for_each_endpoint_of_node(np, epn) {
 		struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
-
-		epn = of_graph_get_next_endpoint(np, epn);
-		if (!epn)
-			return 0;
+		int ret;
 
 		ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 						 &v4l2_epn);
 		if (ret) {
-			ret = -EINVAL;
+			of_node_put(epn);
 			dev_err(dev, "Could not parse the endpoint\n");
-			break;
+			return -EINVAL;
 		}
 
 		subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
 					     GFP_KERNEL);
 		if (!subdev_entity) {
-			ret = -ENOMEM;
-			break;
+			of_node_put(epn);
+			return -ENOMEM;
 		}
 		subdev_entity->epn = epn;
 
@@ -400,9 +396,8 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
 
 		list_add_tail(&subdev_entity->list, &isc->subdev_entities);
 	}
-	of_node_put(epn);
 
-	return ret;
+	return 0;
 }
 
 static int microchip_isc_probe(struct platform_device *pdev)
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index 73445f33d26b..36204fee10aa 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -339,33 +339,29 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
 	struct device_node *epn = NULL;
 	struct isc_subdev_entity *subdev_entity;
 	unsigned int flags;
-	int ret;
 	bool mipi_mode;
 
 	INIT_LIST_HEAD(&isc->subdev_entities);
 
 	mipi_mode = of_property_read_bool(np, "microchip,mipi-mode");
 
-	while (1) {
+	for_each_endpoint_of_node(np, epn) {
 		struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
-
-		epn = of_graph_get_next_endpoint(np, epn);
-		if (!epn)
-			return 0;
+		int ret;
 
 		ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 						 &v4l2_epn);
 		if (ret) {
-			ret = -EINVAL;
+			of_node_put(epn);
 			dev_err(dev, "Could not parse the endpoint\n");
-			break;
+			return -EINVAL;
 		}
 
 		subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
 					     GFP_KERNEL);
 		if (!subdev_entity) {
-			ret = -ENOMEM;
-			break;
+			of_node_put(epn);
+			return -ENOMEM;
 		}
 		subdev_entity->epn = epn;
 
@@ -389,9 +385,8 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
 
 		list_add_tail(&subdev_entity->list, &isc->subdev_entities);
 	}
-	of_node_put(epn);
 
-	return ret;
+	return 0;
 }
 
 static int microchip_xisc_probe(struct platform_device *pdev)
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 3/8] media: platform: microchip: use for_each_endpoint_of_node()
@ 2024-03-25  3:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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>
---
 .../microchip/microchip-sama5d2-isc.c         | 19 +++++++------------
 .../microchip/microchip-sama7g5-isc.c         | 19 +++++++------------
 2 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index 5ac149cf3647..d9298771f509 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -356,30 +356,26 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
 	struct device_node *epn = NULL;
 	struct isc_subdev_entity *subdev_entity;
 	unsigned int flags;
-	int ret;
 
 	INIT_LIST_HEAD(&isc->subdev_entities);
 
-	while (1) {
+	for_each_endpoint_of_node(np, epn) {
 		struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
-
-		epn = of_graph_get_next_endpoint(np, epn);
-		if (!epn)
-			return 0;
+		int ret;
 
 		ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 						 &v4l2_epn);
 		if (ret) {
-			ret = -EINVAL;
+			of_node_put(epn);
 			dev_err(dev, "Could not parse the endpoint\n");
-			break;
+			return -EINVAL;
 		}
 
 		subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
 					     GFP_KERNEL);
 		if (!subdev_entity) {
-			ret = -ENOMEM;
-			break;
+			of_node_put(epn);
+			return -ENOMEM;
 		}
 		subdev_entity->epn = epn;
 
@@ -400,9 +396,8 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
 
 		list_add_tail(&subdev_entity->list, &isc->subdev_entities);
 	}
-	of_node_put(epn);
 
-	return ret;
+	return 0;
 }
 
 static int microchip_isc_probe(struct platform_device *pdev)
diff --git a/drivers/media/platform/microchip/microchip-sama7g5-isc.c b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
index 73445f33d26b..36204fee10aa 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -339,33 +339,29 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
 	struct device_node *epn = NULL;
 	struct isc_subdev_entity *subdev_entity;
 	unsigned int flags;
-	int ret;
 	bool mipi_mode;
 
 	INIT_LIST_HEAD(&isc->subdev_entities);
 
 	mipi_mode = of_property_read_bool(np, "microchip,mipi-mode");
 
-	while (1) {
+	for_each_endpoint_of_node(np, epn) {
 		struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
-
-		epn = of_graph_get_next_endpoint(np, epn);
-		if (!epn)
-			return 0;
+		int ret;
 
 		ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 						 &v4l2_epn);
 		if (ret) {
-			ret = -EINVAL;
+			of_node_put(epn);
 			dev_err(dev, "Could not parse the endpoint\n");
-			break;
+			return -EINVAL;
 		}
 
 		subdev_entity = devm_kzalloc(dev, sizeof(*subdev_entity),
 					     GFP_KERNEL);
 		if (!subdev_entity) {
-			ret = -ENOMEM;
-			break;
+			of_node_put(epn);
+			return -ENOMEM;
 		}
 		subdev_entity->epn = epn;
 
@@ -389,9 +385,8 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
 
 		list_add_tail(&subdev_entity->list, &isc->subdev_entities);
 	}
-	of_node_put(epn);
 
-	return ret;
+	return 0;
 }
 
 static int microchip_xisc_probe(struct platform_device *pdev)
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 4/8] media: platform: ti: use for_each_endpoint_of_node()
  2024-03-25  3:04 ` Kuninori Morimoto
@ 2024-03-25  3:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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];
 		sdinfo->grp_id = 0;
 
@@ -2371,6 +2367,8 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
 		of_node_put(rem);
 		if (IS_ERR(pdata->asd[i]))
 			goto cleanup;
+
+		i++;
 	}
 
 	of_node_put(endpoint);
diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c b/drivers/media/platform/ti/davinci/vpif_capture.c
index c31a5566fc5a..8b7077a265e6 100644
--- a/drivers/media/platform/ti/davinci/vpif_capture.c
+++ b/drivers/media/platform/ti/davinci/vpif_capture.c
@@ -1517,16 +1517,11 @@ vpif_capture_get_pdata(struct platform_device *pdev,
 	if (!pdata->subdev_info)
 		return NULL;
 
-	for (i = 0; i < VPIF_CAPTURE_NUM_CHANNELS; i++) {
+	for_each_endpoint_of_node(pdev->dev.of_node, endpoint) {
 		struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
 		unsigned int flags;
 		int err;
 
-		endpoint = of_graph_get_next_endpoint(pdev->dev.of_node,
-						      endpoint);
-		if (!endpoint)
-			break;
-
 		rem = of_graph_get_remote_port_parent(endpoint);
 		if (!rem) {
 			dev_dbg(&pdev->dev, "Remote device at %pOF not found\n",
@@ -1577,6 +1572,10 @@ vpif_capture_get_pdata(struct platform_device *pdev,
 			goto err_cleanup;
 
 		of_node_put(rem);
+
+		i++;
+		if (i >= VPIF_CAPTURE_NUM_CHANNELS)
+			break;
 	}
 
 done:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 4/8] media: platform: ti: use for_each_endpoint_of_node()
@ 2024-03-25  3:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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];
 		sdinfo->grp_id = 0;
 
@@ -2371,6 +2367,8 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
 		of_node_put(rem);
 		if (IS_ERR(pdata->asd[i]))
 			goto cleanup;
+
+		i++;
 	}
 
 	of_node_put(endpoint);
diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c b/drivers/media/platform/ti/davinci/vpif_capture.c
index c31a5566fc5a..8b7077a265e6 100644
--- a/drivers/media/platform/ti/davinci/vpif_capture.c
+++ b/drivers/media/platform/ti/davinci/vpif_capture.c
@@ -1517,16 +1517,11 @@ vpif_capture_get_pdata(struct platform_device *pdev,
 	if (!pdata->subdev_info)
 		return NULL;
 
-	for (i = 0; i < VPIF_CAPTURE_NUM_CHANNELS; i++) {
+	for_each_endpoint_of_node(pdev->dev.of_node, endpoint) {
 		struct v4l2_fwnode_endpoint bus_cfg = { .bus_type = 0 };
 		unsigned int flags;
 		int err;
 
-		endpoint = of_graph_get_next_endpoint(pdev->dev.of_node,
-						      endpoint);
-		if (!endpoint)
-			break;
-
 		rem = of_graph_get_remote_port_parent(endpoint);
 		if (!rem) {
 			dev_dbg(&pdev->dev, "Remote device at %pOF not found\n",
@@ -1577,6 +1572,10 @@ vpif_capture_get_pdata(struct platform_device *pdev,
 			goto err_cleanup;
 
 		of_node_put(rem);
+
+		i++;
+		if (i >= VPIF_CAPTURE_NUM_CHANNELS)
+			break;
 	}
 
 done:
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 5/8] media: platform: xilinx: use for_each_endpoint_of_node()
  2024-03-25  3:04 ` Kuninori Morimoto
@ 2024-03-25  3:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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/xilinx/xilinx-vipp.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c
index 996684a73038..38818b82a575 100644
--- a/drivers/media/platform/xilinx/xilinx-vipp.c
+++ b/drivers/media/platform/xilinx/xilinx-vipp.c
@@ -205,12 +205,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
 
 	dev_dbg(xdev->dev, "creating links for DMA engines\n");
 
-	while (1) {
-		/* Get the next endpoint and parse its link. */
-		ep = of_graph_get_next_endpoint(node, ep);
-		if (ep == NULL)
-			break;
-
+	for_each_endpoint_of_node(node, ep) {
 		dev_dbg(xdev->dev, "processing endpoint %pOF\n", ep);
 
 		ret = v4l2_fwnode_parse_link(of_fwnode_handle(ep), &link);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 5/8] media: platform: xilinx: use for_each_endpoint_of_node()
@ 2024-03-25  3:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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/xilinx/xilinx-vipp.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c
index 996684a73038..38818b82a575 100644
--- a/drivers/media/platform/xilinx/xilinx-vipp.c
+++ b/drivers/media/platform/xilinx/xilinx-vipp.c
@@ -205,12 +205,7 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
 
 	dev_dbg(xdev->dev, "creating links for DMA engines\n");
 
-	while (1) {
-		/* Get the next endpoint and parse its link. */
-		ep = of_graph_get_next_endpoint(node, ep);
-		if (ep == NULL)
-			break;
-
+	for_each_endpoint_of_node(node, ep) {
 		dev_dbg(xdev->dev, "processing endpoint %pOF\n", ep);
 
 		ret = v4l2_fwnode_parse_link(of_fwnode_handle(ep), &link);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 6/8] staging: media: atmel: use for_each_endpoint_of_node()
  2024-03-25  3:04 ` Kuninori Morimoto
@ 2024-03-25  3:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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/staging/media/deprecated/atmel/atmel-sama5d2-isc.c | 6 +-----
 drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c | 6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
index 31b2b48085c5..cbfbec0c6cb5 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
@@ -340,13 +340,9 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
 
 	INIT_LIST_HEAD(&isc->subdev_entities);
 
-	while (1) {
+	for_each_endpoint_of_node(np, epn) {
 		struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
 
-		epn = of_graph_get_next_endpoint(np, epn);
-		if (!epn)
-			return 0;
-
 		ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 						 &v4l2_epn);
 		if (ret) {
diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
index 020034f631f5..7c477b1d3c48 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
@@ -326,13 +326,9 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
 
 	mipi_mode = of_property_read_bool(np, "microchip,mipi-mode");
 
-	while (1) {
+	for_each_endpoint_of_node(np, epn) {
 		struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
 
-		epn = of_graph_get_next_endpoint(np, epn);
-		if (!epn)
-			return 0;
-
 		ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 						 &v4l2_epn);
 		if (ret) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 6/8] staging: media: atmel: use for_each_endpoint_of_node()
@ 2024-03-25  3:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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/staging/media/deprecated/atmel/atmel-sama5d2-isc.c | 6 +-----
 drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c | 6 +-----
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
index 31b2b48085c5..cbfbec0c6cb5 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
@@ -340,13 +340,9 @@ static int isc_parse_dt(struct device *dev, struct isc_device *isc)
 
 	INIT_LIST_HEAD(&isc->subdev_entities);
 
-	while (1) {
+	for_each_endpoint_of_node(np, epn) {
 		struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
 
-		epn = of_graph_get_next_endpoint(np, epn);
-		if (!epn)
-			return 0;
-
 		ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 						 &v4l2_epn);
 		if (ret) {
diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
index 020034f631f5..7c477b1d3c48 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
@@ -326,13 +326,9 @@ static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
 
 	mipi_mode = of_property_read_bool(np, "microchip,mipi-mode");
 
-	while (1) {
+	for_each_endpoint_of_node(np, epn) {
 		struct v4l2_fwnode_endpoint v4l2_epn = { .bus_type = 0 };
 
-		epn = of_graph_get_next_endpoint(np, epn);
-		if (!epn)
-			return 0;
-
 		ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 						 &v4l2_epn);
 		if (ret) {
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 7/8] video: fbdev: use for_each_endpoint_of_node()
  2024-03-25  3:04 ` Kuninori Morimoto
@ 2024-03-25  3:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
index 09f719af0d0c..d80720c84323 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
@@ -149,8 +149,7 @@ static void __init omapdss_walk_device(struct device_node *node, bool root)
 
 	of_node_put(n);
 
-	n = NULL;
-	while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
+	for_each_endpoint_of_node(node, n) {
 		struct device_node *pn;
 
 		pn = of_graph_get_remote_port_parent(n);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 7/8] video: fbdev: use for_each_endpoint_of_node()
@ 2024-03-25  3:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

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/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
index 09f719af0d0c..d80720c84323 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/omapdss-boot-init.c
@@ -149,8 +149,7 @@ static void __init omapdss_walk_device(struct device_node *node, bool root)
 
 	of_node_put(n);
 
-	n = NULL;
-	while ((n = of_graph_get_next_endpoint(node, n)) != NULL) {
+	for_each_endpoint_of_node(node, n) {
 		struct device_node *pn;
 
 		pn = of_graph_get_remote_port_parent(n);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 8/8] fbdev: omapfb: use of_graph_get_remote_port()
  2024-03-25  3:04 ` Kuninori Morimoto
@ 2024-03-25  3:05   ` Kuninori Morimoto
  -1 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

We already have of_graph_get_remote_port(), Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
index 14965a3fd05b..4040e247e026 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
@@ -117,19 +117,6 @@ u32 dss_of_port_get_port_number(struct device_node *port)
 	return reg;
 }
 
-static struct device_node *omapdss_of_get_remote_port(const struct device_node *node)
-{
-	struct device_node *np;
-
-	np = of_graph_get_remote_endpoint(node);
-	if (!np)
-		return NULL;
-
-	np = of_get_next_parent(np);
-
-	return np;
-}
-
 struct omap_dss_device *
 omapdss_of_find_source_for_first_ep(struct device_node *node)
 {
@@ -141,7 +128,7 @@ omapdss_of_find_source_for_first_ep(struct device_node *node)
 	if (!ep)
 		return ERR_PTR(-EINVAL);
 
-	src_port = omapdss_of_get_remote_port(ep);
+	src_port = of_graph_get_remote_port(ep);
 	if (!src_port) {
 		of_node_put(ep);
 		return ERR_PTR(-EINVAL);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 22+ messages in thread

* [PATCH 8/8] fbdev: omapfb: use of_graph_get_remote_port()
@ 2024-03-25  3:05   ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25  3:05 UTC (permalink / raw)
  To: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

We already have of_graph_get_remote_port(), Let's use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
---
 drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
index 14965a3fd05b..4040e247e026 100644
--- a/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
+++ b/drivers/video/fbdev/omap2/omapfb/dss/dss-of.c
@@ -117,19 +117,6 @@ u32 dss_of_port_get_port_number(struct device_node *port)
 	return reg;
 }
 
-static struct device_node *omapdss_of_get_remote_port(const struct device_node *node)
-{
-	struct device_node *np;
-
-	np = of_graph_get_remote_endpoint(node);
-	if (!np)
-		return NULL;
-
-	np = of_get_next_parent(np);
-
-	return np;
-}
-
 struct omap_dss_device *
 omapdss_of_find_source_for_first_ep(struct device_node *node)
 {
@@ -141,7 +128,7 @@ omapdss_of_find_source_for_first_ep(struct device_node *node)
 	if (!ep)
 		return ERR_PTR(-EINVAL);
 
-	src_port = omapdss_of_get_remote_port(ep);
+	src_port = of_graph_get_remote_port(ep);
 	if (!src_port) {
 		of_node_put(ep);
 		return ERR_PTR(-EINVAL);
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/8] media: platform: ti: use for_each_endpoint_of_node()
  2024-03-25  3:05   ` Kuninori Morimoto
@ 2024-03-25 12:35     ` Dan Carpenter
  -1 siblings, 0 replies; 22+ messages in thread
From: Dan Carpenter @ 2024-03-25 12:35 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

On Mon, Mar 25, 2024 at 03:05:27AM +0000, Kuninori Morimoto wrote:
> 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


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/8] media: platform: ti: use for_each_endpoint_of_node()
@ 2024-03-25 12:35     ` Dan Carpenter
  0 siblings, 0 replies; 22+ messages in thread
From: Dan Carpenter @ 2024-03-25 12:35 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Alexandre Belloni, Alexander Shishkin, Tomi Valkeinen,
	linux-fbdev, dri-devel, Lad,  Prabhakar, Laurent Pinchart,
	David Airlie, linux-omap, Helge Deller, linux-staging,
	linux-media, Daniel Vetter, Suzuki K Poulose, coresight,
	Maarten Lankhorst, Maxime Ripard, Rob Herring, Eugen Hristev,
	Mauro Carvalho Chehab, Michal Simek, linux-arm-kernel,
	Greg Kroah-Hartman, Claudiu Beznea, Thomas Zimmermann

On Mon, Mar 25, 2024 at 03:05:27AM +0000, Kuninori Morimoto wrote:
> 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


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/8] media: platform: ti: use for_each_endpoint_of_node()
  2024-03-25 12:35     ` Dan Carpenter
@ 2024-03-25 23:25       ` Kuninori Morimoto
  -1 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25 23:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Lad,  Prabhakar, Alexander Shishkin, Alexandre Belloni,
	Claudiu Beznea, Daniel Vetter, David Airlie, Eugen Hristev,
	Greg Kroah-Hartman, Helge Deller, Laurent Pinchart,
	Maarten Lankhorst, Mauro Carvalho Chehab, Maxime Ripard,
	Michal Simek, Nicolas Ferre, Rob Herring, Suzuki K Poulose,
	Thomas Zimmermann, Tomi Valkeinen, coresight, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging


Hi Dan

> > 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>
> > ---
(snip)
> > -	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.

Thank you for pointing it.
I will wait other feedback, and post v2 patch in next week.

Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/8] media: platform: ti: use for_each_endpoint_of_node()
@ 2024-03-25 23:25       ` Kuninori Morimoto
  0 siblings, 0 replies; 22+ messages in thread
From: Kuninori Morimoto @ 2024-03-25 23:25 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Alexandre Belloni, Alexander Shishkin, Tomi Valkeinen,
	linux-fbdev, dri-devel, Lad,  Prabhakar, Laurent Pinchart,
	David Airlie, linux-omap, Helge Deller, linux-staging,
	linux-media, Daniel Vetter, Suzuki K Poulose, coresight,
	Maarten Lankhorst, Maxime Ripard, Rob Herring, Eugen Hristev,
	Mauro Carvalho Chehab, Michal Simek, linux-arm-kernel,
	Greg Kroah-Hartman, Claudiu Beznea, Thomas Zimmermann


Hi Dan

> > 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>
> > ---
(snip)
> > -	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.

Thank you for pointing it.
I will wait other feedback, and post v2 patch in next week.

Best regards
---
Renesas Electronics
Ph.D. Kuninori Morimoto

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2024-03-25 23:26 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-25  3:04 [PATCH 0/8] use for_each_endpoint_of_node() Kuninori Morimoto
2024-03-25  3:04 ` Kuninori Morimoto
2024-03-25  3:05 ` [PATCH 1/8] gpu: drm: " Kuninori Morimoto
2024-03-25  3:05   ` Kuninori Morimoto
2024-03-25  3:05 ` [PATCH 2/8] hwtracing: " Kuninori Morimoto
2024-03-25  3:05   ` Kuninori Morimoto
2024-03-25  3:05 ` [PATCH 3/8] media: platform: microchip: " Kuninori Morimoto
2024-03-25  3:05   ` Kuninori Morimoto
2024-03-25  3:05 ` [PATCH 4/8] media: platform: ti: " Kuninori Morimoto
2024-03-25  3:05   ` Kuninori Morimoto
2024-03-25 12:35   ` Dan Carpenter
2024-03-25 12:35     ` Dan Carpenter
2024-03-25 23:25     ` Kuninori Morimoto
2024-03-25 23:25       ` Kuninori Morimoto
2024-03-25  3:05 ` [PATCH 5/8] media: platform: xilinx: " Kuninori Morimoto
2024-03-25  3:05   ` Kuninori Morimoto
2024-03-25  3:05 ` [PATCH 6/8] staging: media: atmel: " Kuninori Morimoto
2024-03-25  3:05   ` Kuninori Morimoto
2024-03-25  3:05 ` [PATCH 7/8] video: fbdev: " Kuninori Morimoto
2024-03-25  3:05   ` Kuninori Morimoto
2024-03-25  3:05 ` [PATCH 8/8] fbdev: omapfb: use of_graph_get_remote_port() Kuninori Morimoto
2024-03-25  3:05   ` Kuninori Morimoto

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.