Skip to content

Commit

Permalink
thermal: cpu_cooling: use cpufreq_dev_list instead of cpufreq_dev_count
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Viresh Kumar authored and Eduardo Valentin committed Dec 8, 2014
1 parent 97afa4a commit 2479bb6
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/thermal/cpu_cooling.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ struct cpufreq_cooling_device {
static DEFINE_IDR(cpufreq_idr);
static DEFINE_MUTEX(cooling_cpufreq_lock);

static unsigned int cpufreq_dev_count;

static LIST_HEAD(cpufreq_dev_list);

/**
Expand Down Expand Up @@ -419,10 +417,9 @@ __cpufreq_cooling_register(struct device_node *np,
mutex_lock(&cooling_cpufreq_lock);

/* Register the notifier for first cpufreq cooling device */
if (cpufreq_dev_count == 0)
if (list_empty(&cpufreq_dev_list))
cpufreq_register_notifier(&thermal_cpufreq_notifier_block,
CPUFREQ_POLICY_NOTIFIER);
cpufreq_dev_count++;
list_add(&cpufreq_dev->node, &cpufreq_dev_list);

mutex_unlock(&cooling_cpufreq_lock);
Expand Down Expand Up @@ -495,10 +492,9 @@ void cpufreq_cooling_unregister(struct thermal_cooling_device *cdev)
cpufreq_dev = cdev->devdata;
mutex_lock(&cooling_cpufreq_lock);
list_del(&cpufreq_dev->node);
cpufreq_dev_count--;

/* Unregister the notifier for the last cpufreq cooling device */
if (cpufreq_dev_count == 0)
if (list_empty(&cpufreq_dev_list))
cpufreq_unregister_notifier(&thermal_cpufreq_notifier_block,
CPUFREQ_POLICY_NOTIFIER);
mutex_unlock(&cooling_cpufreq_lock);
Expand Down

0 comments on commit 2479bb6

Please sign in to comment.