Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 351045
b: refs/heads/master
c: 8e53695
h: refs/heads/master
i:
  351043: ea2a7b6
v: v3
  • Loading branch information
Viresh Kumar authored and Rafael J. Wysocki committed Feb 9, 2013
1 parent 754241c commit 495fe91
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4bd4e42819c7b5b2d608b353f4d9a7717e586479
refs/heads/master: 8e53695f7f1d005fd1fcd3b099cd1bd73683a9f5
6 changes: 4 additions & 2 deletions trunk/drivers/cpufreq/cpufreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -1552,8 +1552,10 @@ static int __cpufreq_governor(struct cpufreq_policy *policy,
policy->cpu, event);
ret = policy->governor->governor(policy, event);

if (!policy->governor->initialized && (event == CPUFREQ_GOV_START))
policy->governor->initialized = 1;
if (event == CPUFREQ_GOV_START)
policy->governor->initialized++;
else if (event == CPUFREQ_GOV_STOP)
policy->governor->initialized--;

/* we keep one module reference alive for
each CPU governed by this CPU */
Expand Down
32 changes: 19 additions & 13 deletions trunk/drivers/cpufreq/cpufreq_governor.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,13 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data,
dbs_data->gov_dbs_timer);
}

rc = sysfs_create_group(cpufreq_global_kobject,
dbs_data->attr_group);
if (rc) {
mutex_unlock(&dbs_data->mutex);
return rc;
if (!policy->governor->initialized) {
rc = sysfs_create_group(cpufreq_global_kobject,
dbs_data->attr_group);
if (rc) {
mutex_unlock(&dbs_data->mutex);
return rc;
}
}

/*
Expand All @@ -262,13 +264,15 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data,
cs_dbs_info->down_skip = 0;
cs_dbs_info->enable = 1;
cs_dbs_info->requested_freq = policy->cur;
cpufreq_register_notifier(cs_ops->notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);

if (!policy->governor->initialized)
if (!policy->governor->initialized) {
cpufreq_register_notifier(cs_ops->notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);

dbs_data->min_sampling_rate =
MIN_SAMPLING_RATE_RATIO *
jiffies_to_usecs(10);
}
} else {
od_dbs_info->rate_mult = 1;
od_dbs_info->sample_type = OD_NORMAL_SAMPLE;
Expand Down Expand Up @@ -311,11 +315,13 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data,
mutex_lock(&dbs_data->mutex);
mutex_destroy(&cpu_cdbs->timer_mutex);

sysfs_remove_group(cpufreq_global_kobject,
dbs_data->attr_group);
if (dbs_data->governor == GOV_CONSERVATIVE)
cpufreq_unregister_notifier(cs_ops->notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);
if (policy->governor->initialized == 1) {
sysfs_remove_group(cpufreq_global_kobject,
dbs_data->attr_group);
if (dbs_data->governor == GOV_CONSERVATIVE)
cpufreq_unregister_notifier(cs_ops->notifier_block,
CPUFREQ_TRANSITION_NOTIFIER);
}
mutex_unlock(&dbs_data->mutex);

break;
Expand Down

0 comments on commit 495fe91

Please sign in to comment.