Skip to content

Commit 04bd2ea

Browse files
committed
OPP: don't drop performance constraint on OPP table removal
This code was added (long back) by commit 009acd1 ("PM / OPP: Support updating performance state of device's power domain") and at that time the `opp->pstate` field was used to store the performance state required by a device's OPP. Over time that changed and the `->pstate` field is now used only for genpd devices and consumer devices access that via the required-opps instead. Because of all these changes, _opp_table_kref_release() now drops the constraint only when the genpd's OPP table gets freed and not the device's. Which is definitely not what we wanted. And dropping the constraint doesn't have much meaning as the genpd itself is going away. Moreover, if we want to drop constraints here, then just dropping the performance constraint alone isn't sufficient as there are other resource constraints like clk, regulator, etc. too, which must be handled. Probably the right thing to do here is to leave this decision to the consumers, which can call `dev_pm_opp_set_rate(dev, 0)` or similar APIs to drop all constraints properly. Which many of the consumers already do. Remove the special code, which is broken anyway. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 64aaeb7 commit 04bd2ea

3 files changed

Lines changed: 1 addition & 19 deletions

File tree

drivers/opp/core.c

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1522,16 +1522,8 @@ static void _opp_table_kref_release(struct kref *kref)
15221522

15231523
WARN_ON(!list_empty(&opp_table->opp_list));
15241524

1525-
list_for_each_entry_safe(opp_dev, temp, &opp_table->dev_list, node) {
1526-
/*
1527-
* The OPP table is getting removed, drop the performance state
1528-
* constraints.
1529-
*/
1530-
if (opp_table->genpd_performance_state)
1531-
dev_pm_genpd_set_performance_state((struct device *)(opp_dev->dev), 0);
1532-
1525+
list_for_each_entry_safe(opp_dev, temp, &opp_table->dev_list, node)
15331526
_remove_opp_dev(opp_dev, opp_table);
1534-
}
15351527

15361528
mutex_destroy(&opp_table->genpd_virt_dev_lock);
15371529
mutex_destroy(&opp_table->lock);

drivers/opp/of.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,14 +1034,6 @@ static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
10341034
goto remove_static_opp;
10351035
}
10361036

1037-
list_for_each_entry(opp, &opp_table->opp_list, node) {
1038-
/* Any non-zero performance state would enable the feature */
1039-
if (opp->pstate) {
1040-
opp_table->genpd_performance_state = true;
1041-
break;
1042-
}
1043-
}
1044-
10451037
lazy_link_required_opp_table(opp_table);
10461038

10471039
return 0;

drivers/opp/opp.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ enum opp_table_access {
182182
* @paths: Interconnect path handles
183183
* @path_count: Number of interconnect paths
184184
* @enabled: Set to true if the device's resources are enabled/configured.
185-
* @genpd_performance_state: Device's power domain support performance state.
186185
* @is_genpd: Marks if the OPP table belongs to a genpd.
187186
* @set_required_opps: Helper responsible to set required OPPs.
188187
* @dentry: debugfs dentry pointer of the real device directory (not links).
@@ -233,7 +232,6 @@ struct opp_table {
233232
struct icc_path **paths;
234233
unsigned int path_count;
235234
bool enabled;
236-
bool genpd_performance_state;
237235
bool is_genpd;
238236
int (*set_required_opps)(struct device *dev,
239237
struct opp_table *opp_table, struct dev_pm_opp *opp, bool scaling_down);

0 commit comments

Comments
 (0)