Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: platform: replace of_graph_get_next_endpoint()

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>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>

authored by

Kuninori Morimoto and committed by
Hans Verkuil
5848915b c188df3d

+9 -9
+2 -2
drivers/media/platform/atmel/atmel-isi.c
··· 834 834 isi->pdata.full_mode = 1; 835 835 isi->pdata.frate = ISI_CFG1_FRATE_CAPTURE_ALL; 836 836 837 - np = of_graph_get_next_endpoint(np, NULL); 837 + np = of_graph_get_endpoint_by_regs(np, 0, -1); 838 838 if (!np) { 839 839 dev_err(&pdev->dev, "Could not find the endpoint\n"); 840 840 return -EINVAL; ··· 1158 1158 struct device_node *ep; 1159 1159 int ret; 1160 1160 1161 - ep = of_graph_get_next_endpoint(isi->dev->of_node, NULL); 1161 + ep = of_graph_get_endpoint_by_regs(isi->dev->of_node, 0, -1); 1162 1162 if (!ep) 1163 1163 return -EINVAL; 1164 1164
+1 -1
drivers/media/platform/intel/pxa_camera.c
··· 2207 2207 pcdev->mclk = mclk_rate; 2208 2208 } 2209 2209 2210 - np = of_graph_get_next_endpoint(np, NULL); 2210 + np = of_graph_get_endpoint_by_regs(np, 0, -1); 2211 2211 if (!np) { 2212 2212 dev_err(dev, "could not find endpoint\n"); 2213 2213 return -EINVAL;
+1 -1
drivers/media/platform/samsung/exynos4-is/fimc-is.c
··· 175 175 return -EINVAL; 176 176 } 177 177 178 - ep = of_graph_get_next_endpoint(node, NULL); 178 + ep = of_graph_get_endpoint_by_regs(node, 0, -1); 179 179 if (!ep) 180 180 return -ENXIO; 181 181
+2 -1
drivers/media/platform/samsung/exynos4-is/mipi-csis.c
··· 727 727 &state->max_num_lanes)) 728 728 return -EINVAL; 729 729 730 - node = of_graph_get_next_endpoint(node, NULL); 730 + /* from port@3 or port@4 */ 731 + node = of_graph_get_endpoint_by_regs(node, -1, -1); 731 732 if (!node) { 732 733 dev_err(&pdev->dev, "No port node at %pOF\n", 733 734 pdev->dev.of_node);
+2 -2
drivers/media/platform/st/stm32/stm32-dcmi.c
··· 1855 1855 struct device_node *ep; 1856 1856 int ret; 1857 1857 1858 - ep = of_graph_get_next_endpoint(dcmi->dev->of_node, NULL); 1858 + ep = of_graph_get_endpoint_by_regs(dcmi->dev->of_node, 0, -1); 1859 1859 if (!ep) { 1860 1860 dev_err(dcmi->dev, "Failed to get next endpoint\n"); 1861 1861 return -EINVAL; ··· 1907 1907 "Could not get reset control\n"); 1908 1908 1909 1909 /* Get bus characteristics from devicetree */ 1910 - np = of_graph_get_next_endpoint(np, NULL); 1910 + np = of_graph_get_endpoint_by_regs(np, 0, -1); 1911 1911 if (!np) { 1912 1912 dev_err(&pdev->dev, "Could not find the endpoint\n"); 1913 1913 return -ENODEV;
+1 -2
drivers/media/platform/ti/davinci/vpif.c
··· 465 465 * so their devices need to be registered manually here 466 466 * for their legacy platform_drivers to work. 467 467 */ 468 - endpoint = of_graph_get_next_endpoint(pdev->dev.of_node, 469 - endpoint); 468 + endpoint = of_graph_get_endpoint_by_regs(pdev->dev.of_node, 0, -1); 470 469 if (!endpoint) 471 470 return 0; 472 471 of_node_put(endpoint);