Merge branches 'pm-cpuidle' and 'pm-opp'

* pm-cpuidle:
  cpuidle: haltpoll: Take 'idle=' override into account

* pm-opp:
  opp: Reinitialize the list_kref before adding the static OPPs again
  opp: core: Revert "add regulators enable and disable"
  opp: of: drop incorrect lockdep_assert_held()
This commit is contained in:
Rafael J. Wysocki 2019-10-24 16:00:43 +02:00
commit 767d2d710e
3 changed files with 14 additions and 15 deletions

View File

@ -95,6 +95,10 @@ static int __init haltpoll_init(void)
int ret; int ret;
struct cpuidle_driver *drv = &haltpoll_driver; struct cpuidle_driver *drv = &haltpoll_driver;
/* Do not load haltpoll if idle= is passed */
if (boot_option_idle_override != IDLE_NO_OVERRIDE)
return -ENODEV;
cpuidle_poll_state_init(drv); cpuidle_poll_state_init(drv);
if (!kvm_para_available() || if (!kvm_para_available() ||

View File

@ -1626,12 +1626,6 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
goto free_regulators; goto free_regulators;
} }
ret = regulator_enable(reg);
if (ret < 0) {
regulator_put(reg);
goto free_regulators;
}
opp_table->regulators[i] = reg; opp_table->regulators[i] = reg;
} }
@ -1645,10 +1639,8 @@ struct opp_table *dev_pm_opp_set_regulators(struct device *dev,
return opp_table; return opp_table;
free_regulators: free_regulators:
while (i--) { while (i != 0)
regulator_disable(opp_table->regulators[i]); regulator_put(opp_table->regulators[--i]);
regulator_put(opp_table->regulators[i]);
}
kfree(opp_table->regulators); kfree(opp_table->regulators);
opp_table->regulators = NULL; opp_table->regulators = NULL;
@ -1674,10 +1666,8 @@ void dev_pm_opp_put_regulators(struct opp_table *opp_table)
/* Make sure there are no concurrent readers while updating opp_table */ /* Make sure there are no concurrent readers while updating opp_table */
WARN_ON(!list_empty(&opp_table->opp_list)); WARN_ON(!list_empty(&opp_table->opp_list));
for (i = opp_table->regulator_count - 1; i >= 0; i--) { for (i = opp_table->regulator_count - 1; i >= 0; i--)
regulator_disable(opp_table->regulators[i]);
regulator_put(opp_table->regulators[i]); regulator_put(opp_table->regulators[i]);
}
_free_set_opp_data(opp_table); _free_set_opp_data(opp_table);

View File

@ -77,8 +77,6 @@ static struct dev_pm_opp *_find_opp_of_np(struct opp_table *opp_table,
{ {
struct dev_pm_opp *opp; struct dev_pm_opp *opp;
lockdep_assert_held(&opp_table_lock);
mutex_lock(&opp_table->lock); mutex_lock(&opp_table->lock);
list_for_each_entry(opp, &opp_table->opp_list, node) { list_for_each_entry(opp, &opp_table->opp_list, node) {
@ -665,6 +663,13 @@ static int _of_add_opp_table_v2(struct device *dev, struct opp_table *opp_table)
return 0; return 0;
} }
/*
* Re-initialize list_kref every time we add static OPPs to the OPP
* table as the reference count may be 0 after the last tie static OPPs
* were removed.
*/
kref_init(&opp_table->list_kref);
/* We have opp-table node now, iterate over it and add OPPs */ /* We have opp-table node now, iterate over it and add OPPs */
for_each_available_child_of_node(opp_table->np, np) { for_each_available_child_of_node(opp_table->np, np) {
opp = _opp_add_static_v2(opp_table, dev, np); opp = _opp_add_static_v2(opp_table, dev, np);