diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-02-07 02:21:27 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-02-08 19:21:13 -0500 |
commit | 8e53695f7f1d005fd1fcd3b099cd1bd73683a9f5 (patch) | |
tree | 12fea44f84d19819b8b07c1b1e8dcaf0a5952e00 /drivers/cpufreq/cpufreq_governor.c | |
parent | 4bd4e42819c7b5b2d608b353f4d9a7717e586479 (diff) |
cpufreq: governors: Fix WARN_ON() for multi-policy platforms
On multi-policy systems there is a single instance of governor for both the
policies (if same governor is chosen for both policies). With the code update
from following patches:
8eeed09 cpufreq: governors: Get rid of dbs_data->enable field
b394058 cpufreq: governors: Reset tunables only for cpufreq_unregister_governor()
We are creating/removing sysfs directory of governor for for every call to
GOV_START and STOP. This would fail for multi-policy system as there is a
per-policy call to START/STOP.
This patch reuses the governor->initialized variable to detect total users of
governor.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq/cpufreq_governor.c')
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index e4a306c8ff1b..5a76086ff09b 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -247,11 +247,13 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, | |||
247 | dbs_data->gov_dbs_timer); | 247 | dbs_data->gov_dbs_timer); |
248 | } | 248 | } |
249 | 249 | ||
250 | rc = sysfs_create_group(cpufreq_global_kobject, | 250 | if (!policy->governor->initialized) { |
251 | dbs_data->attr_group); | 251 | rc = sysfs_create_group(cpufreq_global_kobject, |
252 | if (rc) { | 252 | dbs_data->attr_group); |
253 | mutex_unlock(&dbs_data->mutex); | 253 | if (rc) { |
254 | return rc; | 254 | mutex_unlock(&dbs_data->mutex); |
255 | return rc; | ||
256 | } | ||
255 | } | 257 | } |
256 | 258 | ||
257 | /* | 259 | /* |
@@ -262,13 +264,15 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, | |||
262 | cs_dbs_info->down_skip = 0; | 264 | cs_dbs_info->down_skip = 0; |
263 | cs_dbs_info->enable = 1; | 265 | cs_dbs_info->enable = 1; |
264 | cs_dbs_info->requested_freq = policy->cur; | 266 | cs_dbs_info->requested_freq = policy->cur; |
265 | cpufreq_register_notifier(cs_ops->notifier_block, | ||
266 | CPUFREQ_TRANSITION_NOTIFIER); | ||
267 | 267 | ||
268 | if (!policy->governor->initialized) | 268 | if (!policy->governor->initialized) { |
269 | cpufreq_register_notifier(cs_ops->notifier_block, | ||
270 | CPUFREQ_TRANSITION_NOTIFIER); | ||
271 | |||
269 | dbs_data->min_sampling_rate = | 272 | dbs_data->min_sampling_rate = |
270 | MIN_SAMPLING_RATE_RATIO * | 273 | MIN_SAMPLING_RATE_RATIO * |
271 | jiffies_to_usecs(10); | 274 | jiffies_to_usecs(10); |
275 | } | ||
272 | } else { | 276 | } else { |
273 | od_dbs_info->rate_mult = 1; | 277 | od_dbs_info->rate_mult = 1; |
274 | od_dbs_info->sample_type = OD_NORMAL_SAMPLE; | 278 | od_dbs_info->sample_type = OD_NORMAL_SAMPLE; |
@@ -311,11 +315,13 @@ unlock: | |||
311 | mutex_lock(&dbs_data->mutex); | 315 | mutex_lock(&dbs_data->mutex); |
312 | mutex_destroy(&cpu_cdbs->timer_mutex); | 316 | mutex_destroy(&cpu_cdbs->timer_mutex); |
313 | 317 | ||
314 | sysfs_remove_group(cpufreq_global_kobject, | 318 | if (policy->governor->initialized == 1) { |
315 | dbs_data->attr_group); | 319 | sysfs_remove_group(cpufreq_global_kobject, |
316 | if (dbs_data->governor == GOV_CONSERVATIVE) | 320 | dbs_data->attr_group); |
317 | cpufreq_unregister_notifier(cs_ops->notifier_block, | 321 | if (dbs_data->governor == GOV_CONSERVATIVE) |
318 | CPUFREQ_TRANSITION_NOTIFIER); | 322 | cpufreq_unregister_notifier(cs_ops->notifier_block, |
323 | CPUFREQ_TRANSITION_NOTIFIER); | ||
324 | } | ||
319 | mutex_unlock(&dbs_data->mutex); | 325 | mutex_unlock(&dbs_data->mutex); |
320 | 326 | ||
321 | break; | 327 | break; |