diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2014-12-03 23:12:04 -0500 |
---|---|---|
committer | Eduardo Valentin <edubezval@gmail.com> | 2014-12-08 13:09:15 -0500 |
commit | 2479bb6443d6a793f896219a34bfab0cc410f0b4 (patch) | |
tree | f878dff22f01e913d5fffcd24c0ad1813bf039bb | |
parent | 97afa4aafb821eca197f678b6552488c46f8c48e (diff) |
thermal: cpu_cooling: use cpufreq_dev_list instead of cpufreq_dev_count
As we already have a list of cpufreq_cooling_devices now, lets use it instead of
a local counter.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r-- | drivers/thermal/cpu_cooling.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/thermal/cpu_cooling.c b/drivers/thermal/cpu_cooling.c index d2e6f845fe7d..32ff6dc5efee 100644 --- a/drivers/thermal/cpu_cooling.c +++ b/drivers/thermal/cpu_cooling.c | |||
@@ -71,8 +71,6 @@ struct cpufreq_cooling_device { | |||
71 | static DEFINE_IDR(cpufreq_idr); | 71 | static DEFINE_IDR(cpufreq_idr); |
72 | static DEFINE_MUTEX(cooling_cpufreq_lock); | 72 | static DEFINE_MUTEX(cooling_cpufreq_lock); |
73 | 73 | ||
74 | static unsigned int cpufreq_dev_count; | ||
75 | |||
76 | static LIST_HEAD(cpufreq_dev_list); | 74 | static LIST_HEAD(cpufreq_dev_list); |
77 | 75 | ||
78 | /** | 76 | /** |
@@ -419,10 +417,9 @@ __cpufreq_cooling_register(struct device_node *np, | |||
419 | mutex_lock(&cooling_cpufreq_lock); | 417 | mutex_lock(&cooling_cpufreq_lock); |
420 | 418 | ||
421 | /* Register the notifier for first cpufreq cooling device */ | 419 | /* Register the notifier for first cpufreq cooling device */ |
422 | if (cpufreq_dev_count == 0) | 420 | if (list_empty(&cpufreq_dev_list)) |
423 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, | 421 | cpufreq_register_notifier(&thermal_cpufreq_notifier_block, |
424 | CPUFREQ_POLICY_NOTIFIER); | 422 | CPUFREQ_POLICY_NOTIFIER); |
425 | cpufreq_dev_count++; | ||
426 | list_add(&cpufreq_dev->node, &cpufreq_dev_list); | 423 | list_add(&cpufreq_dev->node, &cpufreq_dev_list); |
427 | 424 | ||
428 | mutex_unlock(&cooling_cpufreq_lock); | 425 | mutex_unlock(&cooling_cpufreq_lock); |
@@ -495,10 +492,9 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev) | |||
495 | cpufreq_dev = cdev->devdata; | 492 | cpufreq_dev = cdev->devdata; |
496 | mutex_lock(&cooling_cpufreq_lock); | 493 | mutex_lock(&cooling_cpufreq_lock); |
497 | list_del(&cpufreq_dev->node); | 494 | list_del(&cpufreq_dev->node); |
498 | cpufreq_dev_count--; | ||
499 | 495 | ||
500 | /* Unregister the notifier for the last cpufreq cooling device */ | 496 | /* Unregister the notifier for the last cpufreq cooling device */ |
501 | if (cpufreq_dev_count == 0) | 497 | if (list_empty(&cpufreq_dev_list)) |
502 | cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, | 498 | cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block, |
503 | CPUFREQ_POLICY_NOTIFIER); | 499 | CPUFREQ_POLICY_NOTIFIER); |
504 | mutex_unlock(&cooling_cpufreq_lock); | 500 | mutex_unlock(&cooling_cpufreq_lock); |