media: i2c: replace of_graph_get_next_endpoint()
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tue, 20 Feb 2024 01:16:21 +0000 (01:16 +0000)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 23 Feb 2024 13:33:32 +0000 (14:33 +0100)
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
Link: https://lore.kernel.org/r/9d1e99b0-892d-4a72-a9b3-886b8ed094b0@xs4all.nl
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>
13 files changed:
drivers/media/i2c/adv7343.c
drivers/media/i2c/adv7604.c
drivers/media/i2c/mt9p031.c
drivers/media/i2c/mt9v032.c
drivers/media/i2c/ov2659.c
drivers/media/i2c/ov5645.c
drivers/media/i2c/ov5647.c
drivers/media/i2c/s5c73m3/s5c73m3-core.c
drivers/media/i2c/s5k5baf.c
drivers/media/i2c/tc358743.c
drivers/media/i2c/tda1997x.c
drivers/media/i2c/tvp514x.c
drivers/media/i2c/tvp7002.c

index ff21cd4744d3d5b383dabe9e63963a83792750f0..4fbe4e18570e9586fe899f7ad3581bbe0277f95d 100644 (file)
@@ -403,7 +403,7 @@ adv7343_get_pdata(struct i2c_client *client)
        if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
                return client->dev.platform_data;
 
-       np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+       np = of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);
        if (!np)
                return NULL;
 
index 810fa8826f308ff9a08b180e2ed013dfaba3128a..319db3e847c4e8269be3216f0f52a2644ad35982 100644 (file)
@@ -3204,8 +3204,8 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 
        np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
 
-       /* Parse the endpoint. */
-       endpoint = of_graph_get_next_endpoint(np, NULL);
+       /* FIXME: Parse the endpoint. */
+       endpoint = of_graph_get_endpoint_by_regs(np, -1, -1);
        if (!endpoint)
                return -EINVAL;
 
index 596200d0248cf0b15517fa46f7c12abb7a8eac97..f4b48121235633482332983c5dd8b6c482696d98 100644 (file)
@@ -1078,7 +1078,7 @@ mt9p031_get_pdata(struct i2c_client *client)
        if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
                return client->dev.platform_data;
 
-       np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+       np = of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);
        if (!np)
                return NULL;
 
index 6dfbd1c56c220e98aaacdc6ea368b443f7ce9056..302120ff125e0b42d9713b564c3ffd7fb0ea4030 100644 (file)
@@ -1006,7 +1006,7 @@ mt9v032_get_pdata(struct i2c_client *client)
        if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
                return client->dev.platform_data;
 
-       np = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+       np = of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);
        if (!np)
                return NULL;
 
index 1d0ef72a64036b6b68c6cd71ce36e94a9aba219b..d1653d7431d0e9404c8e9c6f58414d5668e74af3 100644 (file)
@@ -1388,7 +1388,7 @@ ov2659_get_pdata(struct i2c_client *client)
        if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
                return client->dev.platform_data;
 
-       endpoint = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+       endpoint = of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);
        if (!endpoint)
                return NULL;
 
index df86b951b9f3e9bff4c9d82ded261a074de4d5d4..3b22b9e127873d8b3d4d5ced833547b7b27eefe0 100644 (file)
@@ -1059,7 +1059,7 @@ static int ov5645_probe(struct i2c_client *client)
        ov5645->i2c_client = client;
        ov5645->dev = dev;
 
-       endpoint = of_graph_get_next_endpoint(dev->of_node, NULL);
+       endpoint = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
        if (!endpoint) {
                dev_err(dev, "endpoint node not found\n");
                return -EINVAL;
index 96c0fd4ff5abfc35debdb2f43643f9f2b3f70909..7e1ecdf2485f7a6710380842bbbd861f3652790c 100644 (file)
@@ -1363,7 +1363,7 @@ static int ov5647_parse_dt(struct ov5647 *sensor, struct device_node *np)
        struct device_node *ep;
        int ret;
 
-       ep = of_graph_get_next_endpoint(np, NULL);
+       ep = of_graph_get_endpoint_by_regs(np, 0, -1);
        if (!ep)
                return -EINVAL;
 
index af8d01f78c32adea456e037aaa92564ad7dd8f22..cf6be509af33bd5df850a2da3ec1fbb7ff337fb9 100644 (file)
@@ -1568,7 +1568,7 @@ static int s5c73m3_get_dt_data(struct s5c73m3 *state)
                                     "failed to request gpio S5C73M3_RST\n");
        gpiod_set_consumer_name(state->reset, "S5C73M3_RST");
 
-       node_ep = of_graph_get_next_endpoint(node, NULL);
+       node_ep = of_graph_get_endpoint_by_regs(node, 0, -1);
        if (!node_ep) {
                dev_warn(dev, "no endpoint defined for node: %pOF\n", node);
                return 0;
index de079d2c9282b18220787bd48a3840f8631b2a57..6b11039c35798286021245122d07faa3b0f2992b 100644 (file)
@@ -1849,7 +1849,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf *state, struct device *dev)
                         state->mclk_frequency);
        }
 
-       node_ep = of_graph_get_next_endpoint(node, NULL);
+       node_ep = of_graph_get_endpoint_by_regs(node, 0, -1);
        if (!node_ep) {
                dev_err(dev, "no endpoint defined at node %pOF\n", node);
                return -EINVAL;
index 558152575d1022df74deed355eeee5c6f80b3cd1..3192a334aaab5fedfc27bf503646cec142e80029 100644 (file)
@@ -1895,7 +1895,7 @@ static int tc358743_probe_of(struct tc358743_state *state)
                return dev_err_probe(dev, PTR_ERR(refclk),
                                     "failed to get refclk\n");
 
-       ep = of_graph_get_next_endpoint(dev->of_node, NULL);
+       ep = of_graph_get_endpoint_by_regs(dev->of_node, 0, -1);
        if (!ep) {
                dev_err(dev, "missing endpoint node\n");
                return -EINVAL;
index 1ea703a9909f540382e857522c1670df3f2950b9..8e4a0718c4b6bded84a18067309486759dd37cfd 100644 (file)
@@ -2310,7 +2310,7 @@ static int tda1997x_parse_dt(struct tda1997x_state *state)
        pdata->vidout_sel_de = DE_FREF_SEL_DE_VHREF;
 
        np = state->client->dev.of_node;
-       ep = of_graph_get_next_endpoint(np, NULL);
+       ep = of_graph_get_endpoint_by_regs(np, 0, -1);
        if (!ep)
                return -EINVAL;
 
index 5a561e5bf65981effcb73ad5a98af1ae4a587c86..f9c9c80c33ac14b5acf69f07cffd867819eb5476 100644 (file)
@@ -987,7 +987,7 @@ tvp514x_get_pdata(struct i2c_client *client)
        if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
                return client->dev.platform_data;
 
-       endpoint = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+       endpoint = of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);
        if (!endpoint)
                return NULL;
 
index 30831b4b56d6b18b8c344d2d1ff6005f40947679..6a04ffae534325d83052775c2619227fbd530678 100644 (file)
@@ -893,7 +893,7 @@ tvp7002_get_pdata(struct i2c_client *client)
        if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
                return client->dev.platform_data;
 
-       endpoint = of_graph_get_next_endpoint(client->dev.of_node, NULL);
+       endpoint = of_graph_get_endpoint_by_regs(client->dev.of_node, 0, -1);
        if (!endpoint)
                return NULL;