2020-05-12 12:56:20

by Georgi Djakov

[permalink] [raw]
Subject: [PATCH v8 10/10] OPP: Add support for setting interconnect-tags

From: Sibi Sankar <[email protected]>

Add support for setting tags on icc paths associated with
the opp_table.

Signed-off-by: Sibi Sankar <[email protected]>
Signed-off-by: Georgi Djakov <[email protected]>
---
v8:
* New patch, picked from here:
https://lore.kernel.org/r/[email protected]

drivers/opp/of.c | 24 +++++++++++++++++++-----
1 file changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 3a64f2aa0f86..fd148d54022f 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -336,6 +336,7 @@ int _of_find_icc_paths(struct opp_table *opp_table, struct device *dev)
{
struct device_node *np;
int ret, i, count, num_paths;
+ u32 tag;

np = of_node_get(dev->of_node);
if (!np)
@@ -344,20 +345,25 @@ int _of_find_icc_paths(struct opp_table *opp_table, struct device *dev)
count = of_count_phandle_with_args(np, "interconnects",
"#interconnect-cells");
of_node_put(np);
- if (count < 0)
- return 0;
+ if (count < 0) {
+ ret = 0;
+ goto put_np;
+ }

/* two phandles when #interconnect-cells = <1> */
if (count % 2) {
dev_err(dev, "%s: Invalid interconnects values\n", __func__);
- return -EINVAL;
+ ret = -EINVAL;
+ goto put_np;
}

num_paths = count / 2;
opp_table->paths = kcalloc(num_paths, sizeof(*opp_table->paths),
GFP_KERNEL);
- if (!opp_table->paths)
- return -ENOMEM;
+ if (!opp_table->paths) {
+ ret = -ENOMEM;
+ goto put_np;
+ }

for (i = 0; i < num_paths; i++) {
opp_table->paths[i] = of_icc_get_by_index(dev, i);
@@ -369,8 +375,14 @@ int _of_find_icc_paths(struct opp_table *opp_table, struct device *dev)
}
goto err;
}
+
+ /* Set tag if present */
+ if (!of_property_read_u32_index(np, "interconnect-tags",
+ i, &tag))
+ icc_set_tag(opp_table->paths[i], tag);
}
opp_table->path_count = num_paths;
+ of_node_put(np);

return 0;

@@ -380,6 +392,8 @@ int _of_find_icc_paths(struct opp_table *opp_table, struct device *dev)

kfree(opp_table->paths);
opp_table->paths = NULL;
+put_np:
+ of_node_put(np);

return ret;
}


2020-05-13 06:48:12

by Viresh Kumar

[permalink] [raw]
Subject: Re: [PATCH v8 10/10] OPP: Add support for setting interconnect-tags

On 12-05-20, 15:53, Georgi Djakov wrote:
> From: Sibi Sankar <[email protected]>
>
> Add support for setting tags on icc paths associated with
> the opp_table.
>
> Signed-off-by: Sibi Sankar <[email protected]>
> Signed-off-by: Georgi Djakov <[email protected]>
> ---

Applied this delta:

diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index f71dc5eb0eba..a4972c94f428 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -346,7 +346,6 @@ int dev_pm_opp_of_find_icc_paths(struct device *dev,

count = of_count_phandle_with_args(np, "interconnects",
"#interconnect-cells");
- of_node_put(np);
if (count < 0) {
ret = 0;
goto put_np;
@@ -380,7 +379,7 @@ int dev_pm_opp_of_find_icc_paths(struct device *dev,
/* Set tag if present */
if (!of_property_read_u32_index(np, "interconnect-tags",
i, &tag))
- icc_set_tag(opp_table->paths[i], tag);
+ icc_set_tag(paths[i], tag);
}

if (opp_table) {

--
viresh