diff options
author | Kapileshwar Singh <kapileshwar.singh@arm.com> | 2015-02-12 14:18:16 +0000 |
---|---|---|
committer | Jon Medhurst <tixy@linaro.org> | 2015-02-13 11:47:33 +0800 |
commit | c5a08352fd185fada6f847744b110dac5937e34f (patch) | |
tree | e89f958596472ce7edbacb137e2cc868a415c7c1 | |
parent | 9a1652a91b1625c8c3ea14f34515cdd9a306751f (diff) | |
download | juno-c5a08352fd185fada6f847744b110dac5937e34f.tar.gz |
thermal: cpu_cooling: Handle Hotplugged CPUs
When the leading CPU of the cluster is hotplugged out the
device pointer of the CPU is stale and the platform does not
currently register OPPs for other CPUs in the cluster. The
thermal driver, therefore, is unable to return an OPP.
This patch prevents the flurry of error messages when an invalid
OPP struct is passed to opp_get_voltage
Signed-off-by: Kapileshwar Singh <kapileshwar.singh@arm.com>
Signed-off-by: Jon Medhurst <tixy@linaro.org>
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index 301732ca5b8..c5ee1abcb49 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c @@ -538,15 +538,19 @@ static int get_static_power(struct cpufreq_cooling_device *cpufreq_device, struct cpumask *cpumask = &cpufreq_device->allowed_cpus; unsigned long freq_hz = freq * 1000; - if (!cpufreq_device->plat_get_static_power) { - *power = 0; - return 0; - } + if (!cpufreq_device->plat_get_static_power) + goto no_static_power; rcu_read_lock(); opp = opp_find_freq_exact(cpufreq_device->cpu_dev, freq_hz, true); + + if (IS_ERR_OR_NULL(opp)) { + rcu_read_unlock(); + goto no_static_power; + } + voltage = opp_get_voltage(opp); rcu_read_unlock(); @@ -560,6 +564,10 @@ static int get_static_power(struct cpufreq_cooling_device *cpufreq_device, return cpufreq_device->plat_get_static_power(cpumask, tz->passive_delay, voltage, power); + +no_static_power: + *power = 0; + return 0; } /** |