aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/power/opp/cpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/power/opp/cpu.c')
-rw-r--r--drivers/base/power/opp/cpu.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/base/power/opp/cpu.c b/drivers/base/power/opp/cpu.c
index 83d6e7ba1a34..8c3434bdb26d 100644
--- a/drivers/base/power/opp/cpu.c
+++ b/drivers/base/power/opp/cpu.c
@@ -211,7 +211,7 @@ int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev,
211 } 211 }
212 212
213 /* Mark opp-table as multiple CPUs are sharing it now */ 213 /* Mark opp-table as multiple CPUs are sharing it now */
214 opp_table->shared_opp = true; 214 opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED;
215 } 215 }
216unlock: 216unlock:
217 mutex_unlock(&opp_table_lock); 217 mutex_unlock(&opp_table_lock);
@@ -227,7 +227,8 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus);
227 * 227 *
228 * This updates the @cpumask with CPUs that are sharing OPPs with @cpu_dev. 228 * This updates the @cpumask with CPUs that are sharing OPPs with @cpu_dev.
229 * 229 *
230 * Returns -ENODEV if OPP table isn't already present. 230 * Returns -ENODEV if OPP table isn't already present and -EINVAL if the OPP
231 * table's status is access-unknown.
231 * 232 *
232 * Locking: The internal opp_table and opp structures are RCU protected. 233 * Locking: The internal opp_table and opp structures are RCU protected.
233 * Hence this function internally uses RCU updater strategy with mutex locks 234 * Hence this function internally uses RCU updater strategy with mutex locks
@@ -249,9 +250,14 @@ int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
249 goto unlock; 250 goto unlock;
250 } 251 }
251 252
253 if (opp_table->shared_opp == OPP_TABLE_ACCESS_UNKNOWN) {
254 ret = -EINVAL;
255 goto unlock;
256 }
257
252 cpumask_clear(cpumask); 258 cpumask_clear(cpumask);
253 259
254 if (opp_table->shared_opp) { 260 if (opp_table->shared_opp == OPP_TABLE_ACCESS_SHARED) {
255 list_for_each_entry(opp_dev, &opp_table->dev_list, node) 261 list_for_each_entry(opp_dev, &opp_table->dev_list, node)
256 cpumask_set_cpu(opp_dev->dev->id, cpumask); 262 cpumask_set_cpu(opp_dev->dev->id, cpumask);
257 } else { 263 } else {