Skip to content

Commit 0880d08

Browse files
committed
OPP: Drop redundant code in _link_required_opps()
Due to that the required-devs for the required OPPs are now always being assigned, we no longer need the special treatment in _link_required_opps() for the single PM domain case. Let's therefore drop it. Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20241002122232.194245-8-ulf.hansson@linaro.org
1 parent e130ca9 commit 0880d08

File tree

1 file changed

+3
-36
lines changed

1 file changed

+3
-36
lines changed

drivers/opp/of.c

Lines changed: 3 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ void _of_clear_opp(struct opp_table *opp_table, struct dev_pm_opp *opp)
295295
of_node_put(opp->np);
296296
}
297297

298-
static int _link_required_opps(struct dev_pm_opp *opp, struct opp_table *opp_table,
298+
static int _link_required_opps(struct dev_pm_opp *opp,
299299
struct opp_table *required_table, int index)
300300
{
301301
struct device_node *np;
@@ -313,39 +313,6 @@ static int _link_required_opps(struct dev_pm_opp *opp, struct opp_table *opp_tab
313313
return -ENODEV;
314314
}
315315

316-
/*
317-
* There are two genpd (as required-opp) cases that we need to handle,
318-
* devices with a single genpd and ones with multiple genpds.
319-
*
320-
* The single genpd case requires special handling as we need to use the
321-
* same `dev` structure (instead of a virtual one provided by genpd
322-
* core) for setting the performance state.
323-
*
324-
* It doesn't make sense for a device's DT entry to have both
325-
* "opp-level" and single "required-opps" entry pointing to a genpd's
326-
* OPP, as that would make the OPP core call
327-
* dev_pm_domain_set_performance_state() for two different values for
328-
* the same device structure. Lets treat single genpd configuration as a
329-
* case where the OPP's level is directly available without required-opp
330-
* link in the DT.
331-
*
332-
* Just update the `level` with the right value, which
333-
* dev_pm_opp_set_opp() will take care of in the normal path itself.
334-
*
335-
* There is another case though, where a genpd's OPP table has
336-
* required-opps set to a parent genpd. The OPP core expects the user to
337-
* set the respective required `struct device` pointer via
338-
* dev_pm_opp_set_config().
339-
*/
340-
if (required_table->is_genpd && opp_table->required_opp_count == 1 &&
341-
!opp_table->required_devs[0]) {
342-
/* Genpd core takes care of propagation to parent genpd */
343-
if (!opp_table->is_genpd) {
344-
if (!WARN_ON(opp->level != OPP_LEVEL_UNSET))
345-
opp->level = opp->required_opps[0]->level;
346-
}
347-
}
348-
349316
return 0;
350317
}
351318

@@ -370,7 +337,7 @@ static int _of_opp_alloc_required_opps(struct opp_table *opp_table,
370337
if (IS_ERR_OR_NULL(required_table))
371338
continue;
372339

373-
ret = _link_required_opps(opp, opp_table, required_table, i);
340+
ret = _link_required_opps(opp, required_table, i);
374341
if (ret)
375342
goto free_required_opps;
376343
}
@@ -391,7 +358,7 @@ static int lazy_link_required_opps(struct opp_table *opp_table,
391358
int ret;
392359

393360
list_for_each_entry(opp, &opp_table->opp_list, node) {
394-
ret = _link_required_opps(opp, opp_table, new_table, index);
361+
ret = _link_required_opps(opp, new_table, index);
395362
if (ret)
396363
return ret;
397364
}

0 commit comments

Comments
 (0)