]> git.kernelconcepts.de Git - karo-tx-linux.git/blobdiff - drivers/thermal/cpu_cooling.c
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
[karo-tx-linux.git] / drivers / thermal / cpu_cooling.c
index c6f33218b431a99b0310cd67260c59cad550ebb8..91048eeca28b2dc3d81f234ed60bbfdd796f8277 100644 (file)
@@ -261,8 +261,6 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
        if (!power_table)
                return -ENOMEM;
 
-       rcu_read_lock();
-
        for (freq = 0, i = 0;
             opp = dev_pm_opp_find_freq_ceil(dev, &freq), !IS_ERR(opp);
             freq++, i++) {
@@ -270,13 +268,13 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
                u64 power;
 
                if (i >= num_opps) {
-                       rcu_read_unlock();
                        ret = -EAGAIN;
                        goto free_power_table;
                }
 
                freq_mhz = freq / 1000000;
                voltage_mv = dev_pm_opp_get_voltage(opp) / 1000;
+               dev_pm_opp_put(opp);
 
                /*
                 * Do the multiplication with MHz and millivolt so as
@@ -292,8 +290,6 @@ static int build_dyn_power_table(struct cpufreq_cooling_device *cpufreq_device,
                power_table[i].power = power;
        }
 
-       rcu_read_unlock();
-
        if (i != num_opps) {
                ret = PTR_ERR(opp);
                goto free_power_table;
@@ -397,13 +393,10 @@ static int get_static_power(struct cpufreq_cooling_device *cpufreq_device,
                return 0;
        }
 
-       rcu_read_lock();
-
        opp = dev_pm_opp_find_freq_exact(cpufreq_device->cpu_dev, freq_hz,
                                         true);
        voltage = dev_pm_opp_get_voltage(opp);
-
-       rcu_read_unlock();
+       dev_pm_opp_put(opp);
 
        if (voltage == 0) {
                dev_warn_ratelimited(cpufreq_device->cpu_dev,