Linux on ARM based TI OMAP SoCs
 help / color / mirror / Atom feed
* [PATCH v4 resend 1/9] gpu: drm: replace of_graph_get_next_endpoint()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
@ 2024-06-17  0:58 ` Kuninori Morimoto
  2024-06-17  0:58 ` [PATCH v4 resend 2/9] gpu: drm: use for_each_endpoint_of_node() Kuninori Morimoto
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2024-06-17  0:58 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, Sakari Ailus, Hans Verkuil

From DT point of view, in general, drivers should be asking for a
specific port number because their function is fixed in the binding.

of_graph_get_next_endpoint() doesn't match to this concept.

Simply replace

	- of_graph_get_next_endpoint(xxx, NULL);
	+ of_graph_get_endpoint_by_regs(xxx, 0, -1);

Link: https://lore.kernel.org/r/20240202174941.GA310089-robh@kernel.org
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/gpu/drm/drm_of.c                              | 4 +++-
 drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c | 2 +-
 drivers/gpu/drm/tiny/arcpgu.c                         | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/drm_of.c b/drivers/gpu/drm/drm_of.c
index 177b600895d3c..b6b2cade69aeb 100644
--- a/drivers/gpu/drm/drm_of.c
+++ b/drivers/gpu/drm/drm_of.c
@@ -504,6 +504,8 @@ EXPORT_SYMBOL_GPL(drm_of_get_data_lanes_count_ep);
  * Gets parent DSI bus for a DSI device controlled through a bus other
  * than MIPI-DCS (SPI, I2C, etc.) using the Device Tree.
  *
+ * This function assumes that the device's port@0 is the DSI input.
+ *
  * Returns pointer to mipi_dsi_host if successful, -EINVAL if the
  * request is unsupported, -EPROBE_DEFER if the DSI host is found but
  * not available, or -ENODEV otherwise.
@@ -516,7 +518,7 @@ struct mipi_dsi_host *drm_of_get_dsi_bus(struct device *dev)
 	/*
 	 * Get first endpoint child from device.
 	 */
-	endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
+	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
 	if (!endpoint)
 		return ERR_PTR(-ENODEV);
 
diff --git a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
index 4618c892cdd65..e10e469aa7a6c 100644
--- a/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
+++ b/drivers/gpu/drm/panel/panel-raspberrypi-touchscreen.c
@@ -400,7 +400,7 @@ static int rpi_touchscreen_probe(struct i2c_client *i2c)
 	rpi_touchscreen_i2c_write(ts, REG_POWERON, 0);
 
 	/* Look up the DSI host.  It needs to probe before we do. */
-	endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
+	endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
 	if (!endpoint)
 		return -ENODEV;
 
diff --git a/drivers/gpu/drm/tiny/arcpgu.c b/drivers/gpu/drm/tiny/arcpgu.c
index 4f8f3172379e3..8c29b719ea626 100644
--- a/drivers/gpu/drm/tiny/arcpgu.c
+++ b/drivers/gpu/drm/tiny/arcpgu.c
@@ -288,7 +288,7 @@ static int arcpgu_load(struct arcpgu_drm_private *arcpgu)
 	 * There is only one output port inside each device. It is linked with
 	 * encoder endpoint.
 	 */
-	endpoint_node = of_graph_get_next_endpoint(pdev->dev.of_node, NULL);
+	endpoint_node = of_graph_get_endpoint_by_regs(pdev->dev.of_node, 0, -1);
 	if (endpoint_node) {
 		encoder_node = of_graph_get_remote_port_parent(endpoint_node);
 		of_node_put(endpoint_node);
-- 
2.43.0


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

* [PATCH v4 resend 2/9] gpu: drm: use for_each_endpoint_of_node()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
  2024-06-17  0:58 ` [PATCH v4 resend 1/9] gpu: drm: replace of_graph_get_next_endpoint() Kuninori Morimoto
@ 2024-06-17  0:58 ` Kuninori Morimoto
  2024-06-17  0:59 ` [PATCH v4 resend 3/9] hwtracing: " Kuninori Morimoto
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2024-06-17  0:58 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, Sakari Ailus, Hans Verkuil

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>
Acked-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.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 050ca7eafac58..5f8002f6bb7a5 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.43.0


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

* [PATCH v4 resend 3/9] hwtracing: use for_each_endpoint_of_node()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
  2024-06-17  0:58 ` [PATCH v4 resend 1/9] gpu: drm: replace of_graph_get_next_endpoint() Kuninori Morimoto
  2024-06-17  0:58 ` [PATCH v4 resend 2/9] gpu: drm: use for_each_endpoint_of_node() Kuninori Morimoto
@ 2024-06-17  0:59 ` Kuninori Morimoto
  2024-06-17  0:59 ` [PATCH v4 resend 4/9] media: platform: microchip: " Kuninori Morimoto
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2024-06-17  0:59 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, Sakari Ailus, Hans Verkuil

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>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: James Clark <james.clark@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 9d550f5697fa8..e9683e613d520 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.43.0


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

* [PATCH v4 resend 4/9] media: platform: microchip: use for_each_endpoint_of_node()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
                   ` (2 preceding siblings ...)
  2024-06-17  0:59 ` [PATCH v4 resend 3/9] hwtracing: " Kuninori Morimoto
@ 2024-06-17  0:59 ` Kuninori Morimoto
  2024-06-17  0:59 ` [PATCH v4 resend 5/9] media: platform: ti: " Kuninori Morimoto
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2024-06-17  0:59 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, Sakari Ailus, Hans Verkuil

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: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../microchip/microchip-sama5d2-isc.c         | 21 +++++++------------
 .../microchip/microchip-sama7g5-isc.c         | 21 +++++++------------
 2 files changed, 16 insertions(+), 26 deletions(-)

diff --git a/drivers/media/platform/microchip/microchip-sama5d2-isc.c b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
index 5ac149cf3647f..60b6d922d764e 100644
--- a/drivers/media/platform/microchip/microchip-sama5d2-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama5d2-isc.c
@@ -353,33 +353,29 @@ static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
 static int isc_parse_dt(struct device *dev, struct isc_device *isc)
 {
 	struct device_node *np = dev->of_node;
-	struct device_node *epn = NULL;
+	struct device_node *epn;
 	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 73445f33d26ba..e97abe3e35af0 100644
--- a/drivers/media/platform/microchip/microchip-sama7g5-isc.c
+++ b/drivers/media/platform/microchip/microchip-sama7g5-isc.c
@@ -336,36 +336,32 @@ static const u32 isc_sama7g5_gamma_table[][GAMMA_ENTRIES] = {
 static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
 {
 	struct device_node *np = dev->of_node;
-	struct device_node *epn = NULL;
+	struct device_node *epn;
 	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.43.0


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

* [PATCH v4 resend 5/9] media: platform: ti: use for_each_endpoint_of_node()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
                   ` (3 preceding siblings ...)
  2024-06-17  0:59 ` [PATCH v4 resend 4/9] media: platform: microchip: " Kuninori Morimoto
@ 2024-06-17  0:59 ` Kuninori Morimoto
  2024-06-17  0:59 ` [PATCH v4 resend 6/9] media: platform: xilinx: " Kuninori Morimoto
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2024-06-17  0:59 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, Sakari Ailus, Hans Verkuil

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: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/ti/am437x/am437x-vpfe.c   | 12 +++++-------
 drivers/media/platform/ti/davinci/vpif_capture.c | 14 +++++++-------
 2 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/drivers/media/platform/ti/am437x/am437x-vpfe.c b/drivers/media/platform/ti/am437x/am437x-vpfe.c
index 77e12457d1495..009ff68a2b43c 100644
--- a/drivers/media/platform/ti/am437x/am437x-vpfe.c
+++ b/drivers/media/platform/ti/am437x/am437x-vpfe.c
@@ -2287,7 +2287,7 @@ static const struct v4l2_async_notifier_operations vpfe_async_ops = {
 static struct vpfe_config *
 vpfe_get_pdata(struct vpfe_device *vpfe)
 {
-	struct device_node *endpoint = NULL;
+	struct device_node *endpoint;
 	struct device *dev = vpfe->pdev;
 	struct vpfe_subdev_info *sdinfo;
 	struct vpfe_config *pdata;
@@ -2306,14 +2306,11 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
 	if (!pdata)
 		return NULL;
 
-	for (i = 0; ; i++) {
+	i = 0;
+	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,9 +2368,10 @@ vpfe_get_pdata(struct vpfe_device *vpfe)
 		of_node_put(rem);
 		if (IS_ERR(pdata->asd[i]))
 			goto cleanup;
+
+		i++;
 	}
 
-	of_node_put(endpoint);
 	return pdata;
 
 cleanup:
diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c b/drivers/media/platform/ti/davinci/vpif_capture.c
index c28794b6677b7..16326437767f8 100644
--- a/drivers/media/platform/ti/davinci/vpif_capture.c
+++ b/drivers/media/platform/ti/davinci/vpif_capture.c
@@ -1487,7 +1487,7 @@ static struct vpif_capture_config *
 vpif_capture_get_pdata(struct platform_device *pdev,
 		       struct v4l2_device *v4l2_dev)
 {
-	struct device_node *endpoint = NULL;
+	struct device_node *endpoint;
 	struct device_node *rem = NULL;
 	struct vpif_capture_config *pdata;
 	struct vpif_subdev_info *sdinfo;
@@ -1517,16 +1517,12 @@ vpif_capture_get_pdata(struct platform_device *pdev,
 	if (!pdata->subdev_info)
 		return NULL;
 
-	for (i = 0; i < VPIF_CAPTURE_NUM_CHANNELS; i++) {
+	i = 0;
+	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 +1573,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.43.0


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

* [PATCH v4 resend 6/9] media: platform: xilinx: use for_each_endpoint_of_node()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
                   ` (4 preceding siblings ...)
  2024-06-17  0:59 ` [PATCH v4 resend 5/9] media: platform: ti: " Kuninori Morimoto
@ 2024-06-17  0:59 ` Kuninori Morimoto
  2024-06-17  0:59 ` [PATCH v4 resend 7/9] staging: media: atmel: " Kuninori Morimoto
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2024-06-17  0:59 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, Sakari Ailus, Hans Verkuil

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: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 drivers/media/platform/xilinx/xilinx-vipp.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/media/platform/xilinx/xilinx-vipp.c b/drivers/media/platform/xilinx/xilinx-vipp.c
index 996684a730383..bfe48cc0ab525 100644
--- a/drivers/media/platform/xilinx/xilinx-vipp.c
+++ b/drivers/media/platform/xilinx/xilinx-vipp.c
@@ -199,18 +199,13 @@ static int xvip_graph_build_dma(struct xvip_composite_device *xdev)
 	struct media_pad *sink_pad;
 	struct xvip_graph_entity *ent;
 	struct v4l2_fwnode_link link;
-	struct device_node *ep = NULL;
+	struct device_node *ep;
 	struct xvip_dma *dma;
 	int ret = 0;
 
 	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.43.0


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

* [PATCH v4 resend 7/9] staging: media: atmel: use for_each_endpoint_of_node()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
                   ` (5 preceding siblings ...)
  2024-06-17  0:59 ` [PATCH v4 resend 6/9] media: platform: xilinx: " Kuninori Morimoto
@ 2024-06-17  0:59 ` Kuninori Morimoto
  2024-06-17  0:59 ` [PATCH v4 resend 8/9] video: fbdev: " Kuninori Morimoto
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Kuninori Morimoto @ 2024-06-17  0:59 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, Sakari Ailus, Hans Verkuil

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: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
---
 .../staging/media/deprecated/atmel/atmel-sama5d2-isc.c | 10 +++-------
 .../staging/media/deprecated/atmel/atmel-sama7g5-isc.c | 10 +++-------
 2 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
index 31b2b48085c59..712f916f0935f 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama5d2-isc.c
@@ -333,20 +333,16 @@ static const u32 isc_sama5d2_gamma_table[][GAMMA_ENTRIES] = {
 static int isc_parse_dt(struct device *dev, struct isc_device *isc)
 {
 	struct device_node *np = dev->of_node;
-	struct device_node *epn = NULL;
+	struct device_node *epn;
 	struct isc_subdev_entity *subdev_entity;
 	unsigned int flags;
-	int ret;
+	int ret = -EINVAL;
 
 	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 020034f631f57..9485167d5b7d7 100644
--- a/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
+++ b/drivers/staging/media/deprecated/atmel/atmel-sama7g5-isc.c
@@ -316,23 +316,19 @@ static const u32 isc_sama7g5_gamma_table[][GAMMA_ENTRIES] = {
 static int xisc_parse_dt(struct device *dev, struct isc_device *isc)
 {
 	struct device_node *np = dev->of_node;
-	struct device_node *epn = NULL;
+	struct device_node *epn;
 	struct isc_subdev_entity *subdev_entity;
 	unsigned int flags;
-	int ret;
+	int ret = -EINVAL;
 	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;
-
 		ret = v4l2_fwnode_endpoint_parse(of_fwnode_handle(epn),
 						 &v4l2_epn);
 		if (ret) {
-- 
2.43.0


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

* [PATCH v4 resend 8/9] video: fbdev: use for_each_endpoint_of_node()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
                   ` (6 preceding siblings ...)
  2024-06-17  0:59 ` [PATCH v4 resend 7/9] staging: media: atmel: " Kuninori Morimoto
@ 2024-06-17  0:59 ` Kuninori Morimoto
  2024-06-17  5:53   ` Helge Deller
  2024-06-17  0:59 ` [PATCH v4 resend 9/9] fbdev: omapfb: use of_graph_get_remote_port() Kuninori Morimoto
  2024-06-17  5:58 ` [PATCH v4 resend 0/9] use for_each_endpoint_of_node() Helge Deller
  9 siblings, 1 reply; 12+ messages in thread
From: Kuninori Morimoto @ 2024-06-17  0:59 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, Sakari Ailus, Hans Verkuil

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: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.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 09f719af0d0c9..d80720c843235 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.43.0


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

* [PATCH v4 resend 9/9] fbdev: omapfb: use of_graph_get_remote_port()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
                   ` (7 preceding siblings ...)
  2024-06-17  0:59 ` [PATCH v4 resend 8/9] video: fbdev: " Kuninori Morimoto
@ 2024-06-17  0:59 ` Kuninori Morimoto
  2024-06-17  5:53   ` Helge Deller
  2024-06-17  5:58 ` [PATCH v4 resend 0/9] use for_each_endpoint_of_node() Helge Deller
  9 siblings, 1 reply; 12+ messages in thread
From: Kuninori Morimoto @ 2024-06-17  0:59 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, Sakari Ailus, Hans Verkuil

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

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.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 14965a3fd05b7..4040e247e026e 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.43.0


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

* Re: [PATCH v4 resend 9/9] fbdev: omapfb: use of_graph_get_remote_port()
  2024-06-17  0:59 ` [PATCH v4 resend 9/9] fbdev: omapfb: use of_graph_get_remote_port() Kuninori Morimoto
@ 2024-06-17  5:53   ` Helge Deller
  0 siblings, 0 replies; 12+ messages in thread
From: Helge Deller @ 2024-06-17  5:53 UTC (permalink / raw)
  To: Kuninori Morimoto, dri-devel, linux-arm-kernel, linux-fbdev,
	linux-media, linux-omap, linux-staging

On 6/17/24 02:59, Kuninori Morimoto wrote:
> We already have of_graph_get_remote_port(), Let's use it.
>
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

applied to fbdev git tree.

Thanks!
Helge

> ---
>   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 14965a3fd05b7..4040e247e026e 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);


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

* Re: [PATCH v4 resend 8/9] video: fbdev: use for_each_endpoint_of_node()
  2024-06-17  0:59 ` [PATCH v4 resend 8/9] video: fbdev: " Kuninori Morimoto
@ 2024-06-17  5:53   ` Helge Deller
  0 siblings, 0 replies; 12+ messages in thread
From: Helge Deller @ 2024-06-17  5:53 UTC (permalink / raw)
  To: Kuninori Morimoto, dri-devel, linux-arm-kernel, linux-fbdev,
	linux-media, linux-omap, linux-staging

On 6/17/24 02:59, 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>
> Reviewed-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>

applied to fbdev git tree.

Thanks!
Helge

> ---
>   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 09f719af0d0c9..d80720c843235 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);


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

* Re: [PATCH v4 resend 0/9] use for_each_endpoint_of_node()
       [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
                   ` (8 preceding siblings ...)
  2024-06-17  0:59 ` [PATCH v4 resend 9/9] fbdev: omapfb: use of_graph_get_remote_port() Kuninori Morimoto
@ 2024-06-17  5:58 ` Helge Deller
  9 siblings, 0 replies; 12+ messages in thread
From: Helge Deller @ 2024-06-17  5:58 UTC (permalink / raw)
  To: Kuninori Morimoto, Greg Kroah-Hartman, dri-devel,
	linux-arm-kernel, linux-fbdev, linux-media, linux-omap,
	linux-staging

On 6/17/24 02:58, Kuninori Morimoto wrote:
> Hi Rob, Helge, +Sakari, +Hans

Hi Kuninori,

> 2 weeks past. This is resend v4 patch-set.
> I add +Sakari, +Hans on To.
>
> 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 handle these.

I applied the two fbdev patches (#8 and #9), but I'm not maintainer for "multimedia".
For multimedia I expect people from linux-media@vger.kernel.org to pick your patches.

Helge

>
> I noticed that my posted 1 patch on (A) was not yet included on
> linus/master. I have included it.
>
> Dan is indicating it needs _scoped() macro, but it is new new feature.
> So I think we want to have separate this patch-set and _scoped() patch-set.
> I asked it to ML/Maintainer but no responce, so v4 doesn't include it.
> It will be handled by other patch-set in the future.
>
> [o] done
> [*] this patch-set
>
> 	[o] tidyup of_graph_get_endpoint_count()
> (A)	[o] replace endpoint func - use endpoint_by_regs()
> 	[*] replace endpoint func - use for_each()
> 	[ ] add new port function
> 	[ ] add new endpoint function
>
> v3 -> v4
> 	- fixup ret handling
>
> v2 -> v3
> 	- don't initialize pointer.
> 	- add Reviewed-by / Acked-by
> 	- include not-yet applied missing patch
>
> v1 -> v2
> 	- fixup TI patch
>
> Link: https://lore.kernel.org/r/8734sf6mgn.wl-kuninori.morimoto.gx@renesas.com
> Link: https://lore.kernel.org/r/87cyrauf0x.wl-kuninori.morimoto.gx@renesas.com
> Link: https://lore.kernel.org/r/87le3soy08.wl-kuninori.morimoto.gx@renesas.com
>
> Kuninori Morimoto (9):
>    gpu: drm: replace of_graph_get_next_endpoint()
>    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/drm_of.c                      |  4 +++-
>   drivers/gpu/drm/omapdrm/dss/base.c            |  3 +--
>   .../drm/panel/panel-raspberrypi-touchscreen.c |  2 +-
>   drivers/gpu/drm/tiny/arcpgu.c                 |  2 +-
>   .../hwtracing/coresight/coresight-platform.c  |  4 ++--
>   .../microchip/microchip-sama5d2-isc.c         | 21 +++++++------------
>   .../microchip/microchip-sama7g5-isc.c         | 21 +++++++------------
>   .../media/platform/ti/am437x/am437x-vpfe.c    | 12 +++++------
>   .../media/platform/ti/davinci/vpif_capture.c  | 14 ++++++-------
>   drivers/media/platform/xilinx/xilinx-vipp.c   |  9 ++------
>   .../deprecated/atmel/atmel-sama5d2-isc.c      | 10 +++------
>   .../deprecated/atmel/atmel-sama7g5-isc.c      | 10 +++------
>   drivers/video/fbdev/omap2/omapfb/dss/dss-of.c | 15 +------------
>   .../omap2/omapfb/dss/omapdss-boot-init.c      |  3 +--
>   14 files changed, 46 insertions(+), 84 deletions(-)
>


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

end of thread, other threads:[~2024-06-17  5:59 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87v828s7v0.wl-kuninori.morimoto.gx@renesas.com>
2024-06-17  0:58 ` [PATCH v4 resend 1/9] gpu: drm: replace of_graph_get_next_endpoint() Kuninori Morimoto
2024-06-17  0:58 ` [PATCH v4 resend 2/9] gpu: drm: use for_each_endpoint_of_node() Kuninori Morimoto
2024-06-17  0:59 ` [PATCH v4 resend 3/9] hwtracing: " Kuninori Morimoto
2024-06-17  0:59 ` [PATCH v4 resend 4/9] media: platform: microchip: " Kuninori Morimoto
2024-06-17  0:59 ` [PATCH v4 resend 5/9] media: platform: ti: " Kuninori Morimoto
2024-06-17  0:59 ` [PATCH v4 resend 6/9] media: platform: xilinx: " Kuninori Morimoto
2024-06-17  0:59 ` [PATCH v4 resend 7/9] staging: media: atmel: " Kuninori Morimoto
2024-06-17  0:59 ` [PATCH v4 resend 8/9] video: fbdev: " Kuninori Morimoto
2024-06-17  5:53   ` Helge Deller
2024-06-17  0:59 ` [PATCH v4 resend 9/9] fbdev: omapfb: use of_graph_get_remote_port() Kuninori Morimoto
2024-06-17  5:53   ` Helge Deller
2024-06-17  5:58 ` [PATCH v4 resend 0/9] use for_each_endpoint_of_node() Helge Deller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox