summaryrefslogtreecommitdiff
path: root/drivers/cpufreq/cpufreq_governor.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-02-07 16:25:02 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-03-09 14:40:56 +0100
commitcea6a9e77228c261191bc92df0d24bf5356b99ff (patch)
tree1057de7d1b3a1e98311f69f607ab67f9408723d5 /drivers/cpufreq/cpufreq_governor.c
parentbc505475b85de9a9903e84ef0b369d4637354201 (diff)
cpufreq: governor: Symmetrize cpu_dbs_info initialization and cleanup
Make the initialization of struct cpu_dbs_info objects in alloc_policy_dbs_info() and the code that cleans them up in free_policy_dbs_info() more symmetrical. In particular, set/clear the update_util.func field in those functions along with the policy_dbs field. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/cpufreq/cpufreq_governor.c')
-rw-r--r--drivers/cpufreq/cpufreq_governor.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index 82e50dcf9feb..7c08d8360f72 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -304,14 +304,18 @@ static struct policy_dbs_info *alloc_policy_dbs_info(struct cpufreq_policy *poli
if (!policy_dbs)
return NULL;
- /* Set policy_dbs for all CPUs, online+offline */
- for_each_cpu(j, policy->related_cpus)
- gov->get_cpu_cdbs(j)->policy_dbs = policy_dbs;
-
mutex_init(&policy_dbs->timer_mutex);
atomic_set(&policy_dbs->skip_work, 0);
init_irq_work(&policy_dbs->irq_work, dbs_irq_work);
INIT_WORK(&policy_dbs->work, dbs_work_handler);
+
+ /* Set policy_dbs for all CPUs, online+offline */
+ for_each_cpu(j, policy->related_cpus) {
+ struct cpu_dbs_info *j_cdbs = gov->get_cpu_cdbs(j);
+
+ j_cdbs->policy_dbs = policy_dbs;
+ j_cdbs->update_util.func = dbs_update_util_handler;
+ }
return policy_dbs;
}
@@ -324,9 +328,12 @@ static void free_policy_dbs_info(struct cpufreq_policy *policy,
mutex_destroy(&policy_dbs->timer_mutex);
- for_each_cpu(j, policy->cpus)
- gov->get_cpu_cdbs(j)->policy_dbs = NULL;
+ for_each_cpu(j, policy->related_cpus) {
+ struct cpu_dbs_info *j_cdbs = gov->get_cpu_cdbs(j);
+ j_cdbs->policy_dbs = NULL;
+ j_cdbs->update_util.func = NULL;
+ }
kfree(policy_dbs);
}
@@ -477,8 +484,6 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy)
if (ignore_nice)
j_cdbs->prev_cpu_nice = kcpustat_cpu(j).cpustat[CPUTIME_NICE];
-
- j_cdbs->update_util.func = dbs_update_util_handler;
}
policy_dbs->policy = policy;