]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/base/power/opp/cpu.c
Merge branches 'pm-core', 'pm-qos', 'pm-domains' and 'pm-opp'
[linux.git] / drivers / base / power / opp / cpu.c
index adef788862d5b1ef003105b523425dde9b7db3a9..2d87bc1adf38b682d5416a72987115eb68737000 100644 (file)
@@ -137,12 +137,6 @@ void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, bool of)
  * This removes the OPP tables for CPUs present in the @cpumask.
  * This should be used to remove all the OPPs entries associated with
  * the cpus in @cpumask.
- *
- * Locking: The internal opp_table and opp structures are RCU protected.
- * Hence this function internally uses RCU updater strategy with mutex locks
- * to keep the integrity of the internal data structures. Callers should ensure
- * that this function is *NOT* called under RCU protection or in contexts where
- * mutex cannot be locked.
  */
 void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask)
 {
@@ -159,12 +153,6 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_cpumask_remove_table);
  * @cpumask.
  *
  * Returns -ENODEV if OPP table isn't already present.
- *
- * Locking: The internal opp_table and opp structures are RCU protected.
- * Hence this function internally uses RCU updater strategy with mutex locks
- * to keep the integrity of the internal data structures. Callers should ensure
- * that this function is *NOT* called under RCU protection or in contexts where
- * mutex cannot be locked.
  */
 int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev,
                                const struct cpumask *cpumask)
@@ -174,13 +162,9 @@ int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev,
        struct device *dev;
        int cpu, ret = 0;
 
-       mutex_lock(&opp_table_lock);
-
        opp_table = _find_opp_table(cpu_dev);
-       if (IS_ERR(opp_table)) {
-               ret = PTR_ERR(opp_table);
-               goto unlock;
-       }
+       if (IS_ERR(opp_table))
+               return PTR_ERR(opp_table);
 
        for_each_cpu(cpu, cpumask) {
                if (cpu == cpu_dev->id)
@@ -203,8 +187,8 @@ int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev,
                /* Mark opp-table as multiple CPUs are sharing it now */
                opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED;
        }
-unlock:
-       mutex_unlock(&opp_table_lock);
+
+       dev_pm_opp_put_opp_table(opp_table);
 
        return ret;
 }
@@ -219,12 +203,6 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_set_sharing_cpus);
  *
  * Returns -ENODEV if OPP table isn't already present and -EINVAL if the OPP
  * table's status is access-unknown.
- *
- * Locking: The internal opp_table and opp structures are RCU protected.
- * Hence this function internally uses RCU updater strategy with mutex locks
- * to keep the integrity of the internal data structures. Callers should ensure
- * that this function is *NOT* called under RCU protection or in contexts where
- * mutex cannot be locked.
  */
 int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
 {
@@ -232,17 +210,13 @@ int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
        struct opp_table *opp_table;
        int ret = 0;
 
-       mutex_lock(&opp_table_lock);
-
        opp_table = _find_opp_table(cpu_dev);
-       if (IS_ERR(opp_table)) {
-               ret = PTR_ERR(opp_table);
-               goto unlock;
-       }
+       if (IS_ERR(opp_table))
+               return PTR_ERR(opp_table);
 
        if (opp_table->shared_opp == OPP_TABLE_ACCESS_UNKNOWN) {
                ret = -EINVAL;
-               goto unlock;
+               goto put_opp_table;
        }
 
        cpumask_clear(cpumask);
@@ -254,8 +228,8 @@ int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
                cpumask_set_cpu(cpu_dev->id, cpumask);
        }
 
-unlock:
-       mutex_unlock(&opp_table_lock);
+put_opp_table:
+       dev_pm_opp_put_opp_table(opp_table);
 
        return ret;
 }