diff options
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq.c | 6 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.c | 32 |
2 files changed, 23 insertions, 15 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 0dc9933069c5..cd7644554a62 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1552,8 +1552,10 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, | |||
1552 | policy->cpu, event); | 1552 | policy->cpu, event); |
1553 | ret = policy->governor->governor(policy, event); | 1553 | ret = policy->governor->governor(policy, event); |
1554 | 1554 | ||
1555 | if (!policy->governor->initialized && (event == CPUFREQ_GOV_START)) | 1555 | if (event == CPUFREQ_GOV_START) |
1556 | policy->governor->initialized = 1; | 1556 | policy->governor->initialized++; |
1557 | else if (event == CPUFREQ_GOV_STOP) | ||
1558 | policy->governor->initialized--; | ||
1557 | 1559 | ||
1558 | /* we keep one module reference alive for | 1560 | /* we keep one module reference alive for |
1559 | each CPU governed by this CPU */ | 1561 | each CPU governed by this CPU */ |
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; |