diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2013-01-31 12:28:01 -0500 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2013-02-01 18:01:16 -0500 |
commit | 8eeed0956615294200be783bb67d851280b5b1b9 (patch) | |
tree | 985273bc32c344dbb7eb508a7045255bb4e2b057 /drivers/cpufreq | |
parent | 09dca5ae7531c9df379a2c2484a17438b9e947bc (diff) |
cpufreq: governors: Get rid of dbs_data->enable field
CPUFREQ_GOV_START/STOP are called only once for all policy->cpus and hence we
don't need to adapt cpufreq_governor_dbs() routine for multiple calls.
So, this patch removes dbs_data->enable field entirely. And rearrange code a
bit.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Fabio Baltieri <fabio.baltieri@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.c | 58 | ||||
-rw-r--r-- | drivers/cpufreq/cpufreq_governor.h | 1 |
2 files changed, 20 insertions, 39 deletions
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c index 46f1c78bd16f..29d6a59b1a15 100644 --- a/drivers/cpufreq/cpufreq_governor.c +++ b/drivers/cpufreq/cpufreq_governor.c | |||
@@ -182,6 +182,8 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, | |||
182 | { | 182 | { |
183 | struct od_cpu_dbs_info_s *od_dbs_info = NULL; | 183 | struct od_cpu_dbs_info_s *od_dbs_info = NULL; |
184 | struct cs_cpu_dbs_info_s *cs_dbs_info = NULL; | 184 | struct cs_cpu_dbs_info_s *cs_dbs_info = NULL; |
185 | struct cs_ops *cs_ops = NULL; | ||
186 | struct od_ops *od_ops = NULL; | ||
185 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; | 187 | struct od_dbs_tuners *od_tuners = dbs_data->tuners; |
186 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; | 188 | struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; |
187 | struct cpu_dbs_common_info *cpu_cdbs; | 189 | struct cpu_dbs_common_info *cpu_cdbs; |
@@ -194,10 +196,12 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, | |||
194 | cs_dbs_info = dbs_data->get_cpu_dbs_info_s(cpu); | 196 | cs_dbs_info = dbs_data->get_cpu_dbs_info_s(cpu); |
195 | sampling_rate = &cs_tuners->sampling_rate; | 197 | sampling_rate = &cs_tuners->sampling_rate; |
196 | ignore_nice = cs_tuners->ignore_nice; | 198 | ignore_nice = cs_tuners->ignore_nice; |
199 | cs_ops = dbs_data->gov_ops; | ||
197 | } else { | 200 | } else { |
198 | od_dbs_info = dbs_data->get_cpu_dbs_info_s(cpu); | 201 | od_dbs_info = dbs_data->get_cpu_dbs_info_s(cpu); |
199 | sampling_rate = &od_tuners->sampling_rate; | 202 | sampling_rate = &od_tuners->sampling_rate; |
200 | ignore_nice = od_tuners->ignore_nice; | 203 | ignore_nice = od_tuners->ignore_nice; |
204 | od_ops = dbs_data->gov_ops; | ||
201 | } | 205 | } |
202 | 206 | ||
203 | switch (event) { | 207 | switch (event) { |
@@ -207,10 +211,9 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, | |||
207 | 211 | ||
208 | mutex_lock(&dbs_data->mutex); | 212 | mutex_lock(&dbs_data->mutex); |
209 | 213 | ||
210 | dbs_data->enable++; | ||
211 | for_each_cpu(j, policy->cpus) { | 214 | for_each_cpu(j, policy->cpus) { |
212 | struct cpu_dbs_common_info *j_cdbs; | 215 | struct cpu_dbs_common_info *j_cdbs = |
213 | j_cdbs = dbs_data->get_cpu_cdbs(j); | 216 | dbs_data->get_cpu_cdbs(j); |
214 | 217 | ||
215 | j_cdbs->cpu = j; | 218 | j_cdbs->cpu = j; |
216 | j_cdbs->cur_policy = policy; | 219 | j_cdbs->cur_policy = policy; |
@@ -225,13 +228,6 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, | |||
225 | dbs_data->gov_dbs_timer); | 228 | dbs_data->gov_dbs_timer); |
226 | } | 229 | } |
227 | 230 | ||
228 | /* | ||
229 | * Start the timerschedule work, when this governor is used for | ||
230 | * first time | ||
231 | */ | ||
232 | if (dbs_data->enable != 1) | ||
233 | goto second_time; | ||
234 | |||
235 | rc = sysfs_create_group(cpufreq_global_kobject, | 231 | rc = sysfs_create_group(cpufreq_global_kobject, |
236 | dbs_data->attr_group); | 232 | dbs_data->attr_group); |
237 | if (rc) { | 233 | if (rc) { |
@@ -249,17 +245,19 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, | |||
249 | * governor, thus we are bound to jiffes/HZ | 245 | * governor, thus we are bound to jiffes/HZ |
250 | */ | 246 | */ |
251 | if (dbs_data->governor == GOV_CONSERVATIVE) { | 247 | if (dbs_data->governor == GOV_CONSERVATIVE) { |
252 | struct cs_ops *ops = dbs_data->gov_ops; | 248 | cs_dbs_info->down_skip = 0; |
253 | 249 | cs_dbs_info->enable = 1; | |
254 | cpufreq_register_notifier(ops->notifier_block, | 250 | cs_dbs_info->requested_freq = policy->cur; |
251 | cpufreq_register_notifier(cs_ops->notifier_block, | ||
255 | CPUFREQ_TRANSITION_NOTIFIER); | 252 | CPUFREQ_TRANSITION_NOTIFIER); |
256 | 253 | ||
257 | dbs_data->min_sampling_rate = MIN_SAMPLING_RATE_RATIO * | 254 | dbs_data->min_sampling_rate = MIN_SAMPLING_RATE_RATIO * |
258 | jiffies_to_usecs(10); | 255 | jiffies_to_usecs(10); |
259 | } else { | 256 | } else { |
260 | struct od_ops *ops = dbs_data->gov_ops; | 257 | od_dbs_info->rate_mult = 1; |
261 | 258 | od_dbs_info->sample_type = OD_NORMAL_SAMPLE; | |
262 | od_tuners->io_is_busy = ops->io_busy(); | 259 | od_ops->powersave_bias_init_cpu(cpu); |
260 | od_tuners->io_is_busy = od_ops->io_busy(); | ||
263 | } | 261 | } |
264 | 262 | ||
265 | /* Bring kernel and HW constraints together */ | 263 | /* Bring kernel and HW constraints together */ |
@@ -267,18 +265,6 @@ int cpufreq_governor_dbs(struct dbs_data *dbs_data, | |||
267 | MIN_LATENCY_MULTIPLIER * latency); | 265 | MIN_LATENCY_MULTIPLIER * latency); |
268 | *sampling_rate = max(dbs_data->min_sampling_rate, latency * | 266 | *sampling_rate = max(dbs_data->min_sampling_rate, latency * |
269 | LATENCY_MULTIPLIER); | 267 | LATENCY_MULTIPLIER); |
270 | |||
271 | second_time: | ||
272 | if (dbs_data->governor == GOV_CONSERVATIVE) { | ||
273 | cs_dbs_info->down_skip = 0; | ||
274 | cs_dbs_info->enable = 1; | ||
275 | cs_dbs_info->requested_freq = policy->cur; | ||
276 | } else { | ||
277 | struct od_ops *ops = dbs_data->gov_ops; | ||
278 | od_dbs_info->rate_mult = 1; | ||
279 | od_dbs_info->sample_type = OD_NORMAL_SAMPLE; | ||
280 | ops->powersave_bias_init_cpu(cpu); | ||
281 | } | ||
282 | mutex_unlock(&dbs_data->mutex); | 268 | mutex_unlock(&dbs_data->mutex); |
283 | 269 | ||
284 | /* Initiate timer time stamp */ | 270 | /* Initiate timer time stamp */ |
@@ -297,16 +283,12 @@ second_time: | |||
297 | 283 | ||
298 | mutex_lock(&dbs_data->mutex); | 284 | mutex_lock(&dbs_data->mutex); |
299 | mutex_destroy(&cpu_cdbs->timer_mutex); | 285 | mutex_destroy(&cpu_cdbs->timer_mutex); |
300 | dbs_data->enable--; | 286 | |
301 | if (!dbs_data->enable) { | 287 | sysfs_remove_group(cpufreq_global_kobject, |
302 | struct cs_ops *ops = dbs_data->gov_ops; | 288 | dbs_data->attr_group); |
303 | 289 | if (dbs_data->governor == GOV_CONSERVATIVE) | |
304 | sysfs_remove_group(cpufreq_global_kobject, | 290 | cpufreq_unregister_notifier(cs_ops->notifier_block, |
305 | dbs_data->attr_group); | 291 | CPUFREQ_TRANSITION_NOTIFIER); |
306 | if (dbs_data->governor == GOV_CONSERVATIVE) | ||
307 | cpufreq_unregister_notifier(ops->notifier_block, | ||
308 | CPUFREQ_TRANSITION_NOTIFIER); | ||
309 | } | ||
310 | mutex_unlock(&dbs_data->mutex); | 292 | mutex_unlock(&dbs_data->mutex); |
311 | 293 | ||
312 | break; | 294 | break; |
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h index b72e628e7ed6..c19a16c34361 100644 --- a/drivers/cpufreq/cpufreq_governor.h +++ b/drivers/cpufreq/cpufreq_governor.h | |||
@@ -130,7 +130,6 @@ struct dbs_data { | |||
130 | #define GOV_CONSERVATIVE 1 | 130 | #define GOV_CONSERVATIVE 1 |
131 | int governor; | 131 | int governor; |
132 | unsigned int min_sampling_rate; | 132 | unsigned int min_sampling_rate; |
133 | unsigned int enable; /* number of CPUs using this policy */ | ||
134 | struct attribute_group *attr_group; | 133 | struct attribute_group *attr_group; |
135 | void *tuners; | 134 | void *tuners; |
136 | 135 | ||