>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-r...@kernel.org
Signed-off-by: Kuninori Morimoto <kuninori.morimoto...@renesas.com>
---
 drivers/media/platform/atmel/atmel-isi.c              | 4 ++--
 drivers/media/platform/intel/pxa_camera.c             | 2 +-
 drivers/media/platform/samsung/exynos4-is/fimc-is.c   | 2 +-
 drivers/media/platform/samsung/exynos4-is/mipi-csis.c | 3 ++-
 drivers/media/platform/st/stm32/stm32-dcmi.c          | 4 ++--
 drivers/media/platform/ti/davinci/vpif.c              | 3 +--
 6 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/media/platform/atmel/atmel-isi.c 
b/drivers/media/platform/atmel/atmel-isi.c
index f8450a8ccda6..c1108df72dd5 100644
--- a/drivers/media/platform/atmel/atmel-isi.c
+++ b/drivers/media/platform/atmel/atmel-isi.c
@@ -834,7 +834,7 @@ static int atmel_isi_parse_dt(struct atmel_isi *isi,
        isi->pdata.full_mode = 1;
        isi->pdata.frate = ISI_CFG1_FRATE_CAPTURE_ALL;
 
-       np = of_graph_get_next_endpoint(np, NULL);
+       np = of_graph_get_endpoint_by_regs(np, 0, -1);
        if (!np) {
                dev_err(&pdev->dev, "Could not find the endpoint\n");
                return -EINVAL;
@@ -1158,7 +1158,7 @@ static int isi_graph_init(struct atmel_isi *isi)
        struct device_node *ep;
        int ret;
 
-       ep = of_graph_get_next_endpoint(isi->dev->of_node, NULL);
+       ep = of_graph_get_endpoint_by_regs(isi->dev->of_node, 0, -1);
        if (!ep)
                return -EINVAL;
 
diff --git a/drivers/media/platform/intel/pxa_camera.c 
b/drivers/media/platform/intel/pxa_camera.c
index 59b89e421dc2..d904952bf00e 100644
--- a/drivers/media/platform/intel/pxa_camera.c
+++ b/drivers/media/platform/intel/pxa_camera.c
@@ -2207,7 +2207,7 @@ static int pxa_camera_pdata_from_dt(struct device *dev,
                pcdev->mclk = mclk_rate;
        }
 
-       np = of_graph_get_next_endpoint(np, NULL);
+       np = of_graph_get_endpoint_by_regs(np, 0, -1);
        if (!np) {
                dev_err(dev, "could not find endpoint\n");
                return -EINVAL;
diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is.c 
b/drivers/media/platform/samsung/exynos4-is/fimc-is.c
index a08c87ef6e2d..39aab667910d 100644
--- a/drivers/media/platform/samsung/exynos4-is/fimc-is.c
+++ b/drivers/media/platform/samsung/exynos4-is/fimc-is.c
@@ -175,7 +175,7 @@ static int fimc_is_parse_sensor_config(struct fimc_is *is, 
unsigned int index,
                return -EINVAL;
        }
 
-       ep = of_graph_get_next_endpoint(node, NULL);
+       ep = of_graph_get_endpoint_by_regs(node, 0, -1);
        if (!ep)
                return -ENXIO;
 
diff --git a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c 
b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c
index aae8a8b2c0f4..4b9b20ba3504 100644
--- a/drivers/media/platform/samsung/exynos4-is/mipi-csis.c
+++ b/drivers/media/platform/samsung/exynos4-is/mipi-csis.c
@@ -727,7 +727,8 @@ static int s5pcsis_parse_dt(struct platform_device *pdev,
                                 &state->max_num_lanes))
                return -EINVAL;
 
-       node = of_graph_get_next_endpoint(node, NULL);
+       /* from port@3 or port@4 */
+       node = of_graph_get_endpoint_by_regs(node, -1, -1);
        if (!node) {
                dev_err(&pdev->dev, "No port node at %pOF\n",
                                pdev->dev.of_node);
diff --git a/drivers/media/platform/st/stm32/stm32-dcmi.c 
b/drivers/media/platform/st/stm32/stm32-dcmi.c
index c4610e305546..ff3331af9406 100644
--- a/drivers/media/platform/st/stm32/stm32-dcmi.c
+++ b/drivers/media/platform/st/stm32/stm32-dcmi.c
@@ -1855,7 +1855,7 @@ static int dcmi_graph_init(struct stm32_dcmi *dcmi)
        struct device_node *ep;
        int ret;
 
-       ep = of_graph_get_next_endpoint(dcmi->dev->of_node, NULL);
+       ep = of_graph_get_endpoint_by_regs(dcmi->dev->of_node, 0, -1);
        if (!ep) {
                dev_err(dcmi->dev, "Failed to get next endpoint\n");
                return -EINVAL;
@@ -1907,7 +1907,7 @@ static int dcmi_probe(struct platform_device *pdev)
                                     "Could not get reset control\n");
 
        /* Get bus characteristics from devicetree */
-       np = of_graph_get_next_endpoint(np, NULL);
+       np = of_graph_get_endpoint_by_regs(np, 0, -1);
        if (!np) {
                dev_err(&pdev->dev, "Could not find the endpoint\n");
                return -ENODEV;
diff --git a/drivers/media/platform/ti/davinci/vpif.c 
b/drivers/media/platform/ti/davinci/vpif.c
index 63cdfed37bc9..f4e1fa76bf37 100644
--- a/drivers/media/platform/ti/davinci/vpif.c
+++ b/drivers/media/platform/ti/davinci/vpif.c
@@ -465,8 +465,7 @@ static int vpif_probe(struct platform_device *pdev)
         * so their devices need to be registered manually here
         * for their legacy platform_drivers to work.
         */
-       endpoint = of_graph_get_next_endpoint(pdev->dev.of_node,
-                                             endpoint);
+       endpoint = of_graph_get_endpoint_by_regs(pdev->dev.of_node, 0, -1);
        if (!endpoint)
                return 0;
        of_node_put(endpoint);
-- 
2.25.1

Reply via email to