aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/cpufreq/amd_freq_sensitivity.c3
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c6
-rw-r--r--drivers/cpufreq/cpufreq_governor.c74
-rw-r--r--drivers/cpufreq/cpufreq_governor.h27
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c18
5 files changed, 68 insertions, 60 deletions
diff --git a/drivers/cpufreq/amd_freq_sensitivity.c b/drivers/cpufreq/amd_freq_sensitivity.c
index 6395a5f0ff25..82ae1002def1 100644
--- a/drivers/cpufreq/amd_freq_sensitivity.c
+++ b/drivers/cpufreq/amd_freq_sensitivity.c
@@ -45,7 +45,8 @@ static unsigned int amd_powersave_bias_target(struct cpufreq_policy *policy,
45 long d_actual, d_reference; 45 long d_actual, d_reference;
46 struct msr actual, reference; 46 struct msr actual, reference;
47 struct cpu_data_t *data = &per_cpu(cpu_data, policy->cpu); 47 struct cpu_data_t *data = &per_cpu(cpu_data, policy->cpu);
48 struct dbs_data *od_data = policy->governor_data; 48 struct policy_dbs_info *policy_dbs = policy->governor_data;
49 struct dbs_data *od_data = policy_dbs->dbs_data;
49 struct od_dbs_tuners *od_tuners = od_data->tuners; 50 struct od_dbs_tuners *od_tuners = od_data->tuners;
50 struct od_cpu_dbs_info_s *od_info = 51 struct od_cpu_dbs_info_s *od_info =
51 dbs_governor_of(policy)->get_cpu_dbs_info_s(policy->cpu); 52 dbs_governor_of(policy)->get_cpu_dbs_info_s(policy->cpu);
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index b8054e53a37e..1a899bb7d1a4 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -48,7 +48,8 @@ static void cs_check_cpu(int cpu, unsigned int load)
48{ 48{
49 struct cs_cpu_dbs_info_s *dbs_info = &per_cpu(cs_cpu_dbs_info, cpu); 49 struct cs_cpu_dbs_info_s *dbs_info = &per_cpu(cs_cpu_dbs_info, cpu);
50 struct cpufreq_policy *policy = dbs_info->cdbs.policy_dbs->policy; 50 struct cpufreq_policy *policy = dbs_info->cdbs.policy_dbs->policy;
51 struct dbs_data *dbs_data = policy->governor_data; 51 struct policy_dbs_info *policy_dbs = policy->governor_data;
52 struct dbs_data *dbs_data = policy_dbs->dbs_data;
52 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; 53 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
53 54
54 /* 55 /*
@@ -104,7 +105,8 @@ static void cs_check_cpu(int cpu, unsigned int load)
104 105
105static unsigned int cs_dbs_timer(struct cpufreq_policy *policy) 106static unsigned int cs_dbs_timer(struct cpufreq_policy *policy)
106{ 107{
107 struct dbs_data *dbs_data = policy->governor_data; 108 struct policy_dbs_info *policy_dbs = policy->governor_data;
109 struct dbs_data *dbs_data = policy_dbs->dbs_data;
108 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; 110 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
109 111
110 dbs_check_cpu(policy); 112 dbs_check_cpu(policy);
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index ff247a7ac774..82e50dcf9feb 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -35,8 +35,8 @@ void dbs_check_cpu(struct cpufreq_policy *policy)
35{ 35{
36 int cpu = policy->cpu; 36 int cpu = policy->cpu;
37 struct dbs_governor *gov = dbs_governor_of(policy); 37 struct dbs_governor *gov = dbs_governor_of(policy);
38 struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(cpu); 38 struct policy_dbs_info *policy_dbs = policy->governor_data;
39 struct dbs_data *dbs_data = policy->governor_data; 39 struct dbs_data *dbs_data = policy_dbs->dbs_data;
40 struct od_dbs_tuners *od_tuners = dbs_data->tuners; 40 struct od_dbs_tuners *od_tuners = dbs_data->tuners;
41 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; 41 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
42 unsigned int sampling_rate; 42 unsigned int sampling_rate;
@@ -95,6 +95,7 @@ void dbs_check_cpu(struct cpufreq_policy *policy)
95 j_cdbs->prev_cpu_idle = cur_idle_time; 95 j_cdbs->prev_cpu_idle = cur_idle_time;
96 96
97 if (ignore_nice) { 97 if (ignore_nice) {
98 struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(cpu);
98 u64 cur_nice; 99 u64 cur_nice;
99 unsigned long cur_nice_jiffies; 100 unsigned long cur_nice_jiffies;
100 101
@@ -292,8 +293,8 @@ static void set_sampling_rate(struct dbs_data *dbs_data,
292 } 293 }
293} 294}
294 295
295static int alloc_policy_dbs_info(struct cpufreq_policy *policy, 296static struct policy_dbs_info *alloc_policy_dbs_info(struct cpufreq_policy *policy,
296 struct dbs_governor *gov) 297 struct dbs_governor *gov)
297{ 298{
298 struct policy_dbs_info *policy_dbs; 299 struct policy_dbs_info *policy_dbs;
299 int j; 300 int j;
@@ -301,7 +302,7 @@ static int alloc_policy_dbs_info(struct cpufreq_policy *policy,
301 /* Allocate memory for the common information for policy->cpus */ 302 /* Allocate memory for the common information for policy->cpus */
302 policy_dbs = kzalloc(sizeof(*policy_dbs), GFP_KERNEL); 303 policy_dbs = kzalloc(sizeof(*policy_dbs), GFP_KERNEL);
303 if (!policy_dbs) 304 if (!policy_dbs)
304 return -ENOMEM; 305 return NULL;
305 306
306 /* Set policy_dbs for all CPUs, online+offline */ 307 /* Set policy_dbs for all CPUs, online+offline */
307 for_each_cpu(j, policy->related_cpus) 308 for_each_cpu(j, policy->related_cpus)
@@ -311,7 +312,7 @@ static int alloc_policy_dbs_info(struct cpufreq_policy *policy,
311 atomic_set(&policy_dbs->skip_work, 0); 312 atomic_set(&policy_dbs->skip_work, 0);
312 init_irq_work(&policy_dbs->irq_work, dbs_irq_work); 313 init_irq_work(&policy_dbs->irq_work, dbs_irq_work);
313 INIT_WORK(&policy_dbs->work, dbs_work_handler); 314 INIT_WORK(&policy_dbs->work, dbs_work_handler);
314 return 0; 315 return policy_dbs;
315} 316}
316 317
317static void free_policy_dbs_info(struct cpufreq_policy *policy, 318static void free_policy_dbs_info(struct cpufreq_policy *policy,
@@ -333,6 +334,7 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy)
333{ 334{
334 struct dbs_governor *gov = dbs_governor_of(policy); 335 struct dbs_governor *gov = dbs_governor_of(policy);
335 struct dbs_data *dbs_data = gov->gdbs_data; 336 struct dbs_data *dbs_data = gov->gdbs_data;
337 struct policy_dbs_info *policy_dbs;
336 unsigned int latency; 338 unsigned int latency;
337 int ret; 339 int ret;
338 340
@@ -340,26 +342,26 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy)
340 if (policy->governor_data) 342 if (policy->governor_data)
341 return -EBUSY; 343 return -EBUSY;
342 344
343 if (dbs_data) { 345 policy_dbs = alloc_policy_dbs_info(policy, gov);
344 if (WARN_ON(have_governor_per_policy())) 346 if (!policy_dbs)
345 return -EINVAL; 347 return -ENOMEM;
346
347 ret = alloc_policy_dbs_info(policy, gov);
348 if (ret)
349 return ret;
350 348
349 if (dbs_data) {
350 if (WARN_ON(have_governor_per_policy())) {
351 ret = -EINVAL;
352 goto free_policy_dbs_info;
353 }
351 dbs_data->usage_count++; 354 dbs_data->usage_count++;
352 policy->governor_data = dbs_data; 355 policy_dbs->dbs_data = dbs_data;
356 policy->governor_data = policy_dbs;
353 return 0; 357 return 0;
354 } 358 }
355 359
356 dbs_data = kzalloc(sizeof(*dbs_data), GFP_KERNEL); 360 dbs_data = kzalloc(sizeof(*dbs_data), GFP_KERNEL);
357 if (!dbs_data) 361 if (!dbs_data) {
358 return -ENOMEM; 362 ret = -ENOMEM;
359 363 goto free_policy_dbs_info;
360 ret = alloc_policy_dbs_info(policy, gov); 364 }
361 if (ret)
362 goto free_dbs_data;
363 365
364 dbs_data->usage_count = 1; 366 dbs_data->usage_count = 1;
365 367
@@ -381,7 +383,8 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy)
381 if (!have_governor_per_policy()) 383 if (!have_governor_per_policy())
382 gov->gdbs_data = dbs_data; 384 gov->gdbs_data = dbs_data;
383 385
384 policy->governor_data = dbs_data; 386 policy_dbs->dbs_data = dbs_data;
387 policy->governor_data = policy_dbs;
385 388
386 ret = sysfs_create_group(get_governor_parent_kobj(policy), 389 ret = sysfs_create_group(get_governor_parent_kobj(policy),
387 get_sysfs_attr(gov)); 390 get_sysfs_attr(gov));
@@ -396,21 +399,21 @@ reset_gdbs_data:
396 if (!have_governor_per_policy()) 399 if (!have_governor_per_policy())
397 gov->gdbs_data = NULL; 400 gov->gdbs_data = NULL;
398 gov->exit(dbs_data, !policy->governor->initialized); 401 gov->exit(dbs_data, !policy->governor->initialized);
402 kfree(dbs_data);
403
399free_policy_dbs_info: 404free_policy_dbs_info:
400 free_policy_dbs_info(policy, gov); 405 free_policy_dbs_info(policy, gov);
401free_dbs_data:
402 kfree(dbs_data);
403 return ret; 406 return ret;
404} 407}
405 408
406static int cpufreq_governor_exit(struct cpufreq_policy *policy) 409static int cpufreq_governor_exit(struct cpufreq_policy *policy)
407{ 410{
408 struct dbs_governor *gov = dbs_governor_of(policy); 411 struct dbs_governor *gov = dbs_governor_of(policy);
409 struct dbs_data *dbs_data = policy->governor_data; 412 struct policy_dbs_info *policy_dbs = policy->governor_data;
410 struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(policy->cpu); 413 struct dbs_data *dbs_data = policy_dbs->dbs_data;
411 414
412 /* State should be equivalent to INIT */ 415 /* State should be equivalent to INIT */
413 if (!cdbs->policy_dbs || cdbs->policy_dbs->policy) 416 if (policy_dbs->policy)
414 return -EBUSY; 417 return -EBUSY;
415 418
416 if (!--dbs_data->usage_count) { 419 if (!--dbs_data->usage_count) {
@@ -435,17 +438,16 @@ static int cpufreq_governor_exit(struct cpufreq_policy *policy)
435static int cpufreq_governor_start(struct cpufreq_policy *policy) 438static int cpufreq_governor_start(struct cpufreq_policy *policy)
436{ 439{
437 struct dbs_governor *gov = dbs_governor_of(policy); 440 struct dbs_governor *gov = dbs_governor_of(policy);
438 struct dbs_data *dbs_data = policy->governor_data; 441 struct policy_dbs_info *policy_dbs = policy->governor_data;
442 struct dbs_data *dbs_data = policy_dbs->dbs_data;
439 unsigned int sampling_rate, ignore_nice, j, cpu = policy->cpu; 443 unsigned int sampling_rate, ignore_nice, j, cpu = policy->cpu;
440 struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(cpu);
441 struct policy_dbs_info *policy_dbs = cdbs->policy_dbs;
442 int io_busy = 0; 444 int io_busy = 0;
443 445
444 if (!policy->cur) 446 if (!policy->cur)
445 return -EINVAL; 447 return -EINVAL;
446 448
447 /* State should be equivalent to INIT */ 449 /* State should be equivalent to INIT */
448 if (!policy_dbs || policy_dbs->policy) 450 if (policy_dbs->policy)
449 return -EBUSY; 451 return -EBUSY;
450 452
451 if (gov->governor == GOV_CONSERVATIVE) { 453 if (gov->governor == GOV_CONSERVATIVE) {
@@ -501,12 +503,10 @@ static int cpufreq_governor_start(struct cpufreq_policy *policy)
501 503
502static int cpufreq_governor_stop(struct cpufreq_policy *policy) 504static int cpufreq_governor_stop(struct cpufreq_policy *policy)
503{ 505{
504 struct dbs_governor *gov = dbs_governor_of(policy); 506 struct policy_dbs_info *policy_dbs = policy->governor_data;
505 struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(policy->cpu);
506 struct policy_dbs_info *policy_dbs = cdbs->policy_dbs;
507 507
508 /* State should be equivalent to START */ 508 /* State should be equivalent to START */
509 if (!policy_dbs || !policy_dbs->policy) 509 if (!policy_dbs->policy)
510 return -EBUSY; 510 return -EBUSY;
511 511
512 gov_cancel_work(policy_dbs); 512 gov_cancel_work(policy_dbs);
@@ -517,12 +517,10 @@ static int cpufreq_governor_stop(struct cpufreq_policy *policy)
517 517
518static int cpufreq_governor_limits(struct cpufreq_policy *policy) 518static int cpufreq_governor_limits(struct cpufreq_policy *policy)
519{ 519{
520 struct dbs_governor *gov = dbs_governor_of(policy); 520 struct policy_dbs_info *policy_dbs = policy->governor_data;
521 struct cpu_dbs_info *cdbs = gov->get_cpu_cdbs(policy->cpu);
522 struct policy_dbs_info *policy_dbs = cdbs->policy_dbs;
523 521
524 /* State should be equivalent to START */ 522 /* State should be equivalent to START */
525 if (!policy_dbs || !policy_dbs->policy) 523 if (!policy_dbs->policy)
526 return -EBUSY; 524 return -EBUSY;
527 525
528 mutex_lock(&policy_dbs->timer_mutex); 526 mutex_lock(&policy_dbs->timer_mutex);
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index 63868d7f14f5..95e6834d36a8 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -85,7 +85,8 @@ static ssize_t show_##file_name##_gov_sys \
85static ssize_t show_##file_name##_gov_pol \ 85static ssize_t show_##file_name##_gov_pol \
86(struct cpufreq_policy *policy, char *buf) \ 86(struct cpufreq_policy *policy, char *buf) \
87{ \ 87{ \
88 struct dbs_data *dbs_data = policy->governor_data; \ 88 struct policy_dbs_info *policy_dbs = policy->governor_data; \
89 struct dbs_data *dbs_data = policy_dbs->dbs_data; \
89 struct _gov##_dbs_tuners *tuners = dbs_data->tuners; \ 90 struct _gov##_dbs_tuners *tuners = dbs_data->tuners; \
90 return sprintf(buf, "%u\n", tuners->file_name); \ 91 return sprintf(buf, "%u\n", tuners->file_name); \
91} 92}
@@ -101,8 +102,8 @@ static ssize_t store_##file_name##_gov_sys \
101static ssize_t store_##file_name##_gov_pol \ 102static ssize_t store_##file_name##_gov_pol \
102(struct cpufreq_policy *policy, const char *buf, size_t count) \ 103(struct cpufreq_policy *policy, const char *buf, size_t count) \
103{ \ 104{ \
104 struct dbs_data *dbs_data = policy->governor_data; \ 105 struct policy_dbs_info *policy_dbs = policy->governor_data; \
105 return store_##file_name(dbs_data, buf, count); \ 106 return store_##file_name(policy_dbs->dbs_data, buf, count); \
106} 107}
107 108
108#define show_store_one(_gov, file_name) \ 109#define show_store_one(_gov, file_name) \
@@ -130,6 +131,13 @@ static void *get_cpu_dbs_info_s(int cpu) \
130 * cs_*: Conservative governor 131 * cs_*: Conservative governor
131 */ 132 */
132 133
134/* Governor demand based switching data (per-policy or global). */
135struct dbs_data {
136 unsigned int min_sampling_rate;
137 int usage_count;
138 void *tuners;
139};
140
133/* Common to all CPUs of a policy */ 141/* Common to all CPUs of a policy */
134struct policy_dbs_info { 142struct policy_dbs_info {
135 struct cpufreq_policy *policy; 143 struct cpufreq_policy *policy;
@@ -144,6 +152,8 @@ struct policy_dbs_info {
144 atomic_t skip_work; 152 atomic_t skip_work;
145 struct irq_work irq_work; 153 struct irq_work irq_work;
146 struct work_struct work; 154 struct work_struct work;
155 /* dbs_data may be shared between multiple policy objects */
156 struct dbs_data *dbs_data;
147}; 157};
148 158
149static inline void gov_update_sample_delay(struct policy_dbs_info *policy_dbs, 159static inline void gov_update_sample_delay(struct policy_dbs_info *policy_dbs,
@@ -204,7 +214,6 @@ struct cs_dbs_tuners {
204}; 214};
205 215
206/* Common Governor data across policies */ 216/* Common Governor data across policies */
207struct dbs_data;
208struct dbs_governor { 217struct dbs_governor {
209 struct cpufreq_governor gov; 218 struct cpufreq_governor gov;
210 219
@@ -236,13 +245,6 @@ static inline struct dbs_governor *dbs_governor_of(struct cpufreq_policy *policy
236 return container_of(policy->governor, struct dbs_governor, gov); 245 return container_of(policy->governor, struct dbs_governor, gov);
237} 246}
238 247
239/* Governor Per policy data */
240struct dbs_data {
241 unsigned int min_sampling_rate;
242 int usage_count;
243 void *tuners;
244};
245
246/* Governor specific ops, will be passed to dbs_data->gov_ops */ 248/* Governor specific ops, will be passed to dbs_data->gov_ops */
247struct od_ops { 249struct od_ops {
248 void (*powersave_bias_init_cpu)(int cpu); 250 void (*powersave_bias_init_cpu)(int cpu);
@@ -273,7 +275,8 @@ static ssize_t show_sampling_rate_min_gov_sys \
273static ssize_t show_sampling_rate_min_gov_pol \ 275static ssize_t show_sampling_rate_min_gov_pol \
274(struct cpufreq_policy *policy, char *buf) \ 276(struct cpufreq_policy *policy, char *buf) \
275{ \ 277{ \
276 struct dbs_data *dbs_data = policy->governor_data; \ 278 struct policy_dbs_info *policy_dbs = policy->governor_data; \
279 struct dbs_data *dbs_data = policy_dbs->dbs_data; \
277 return sprintf(buf, "%u\n", dbs_data->min_sampling_rate); \ 280 return sprintf(buf, "%u\n", dbs_data->min_sampling_rate); \
278} 281}
279 282
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 9ef4402644c7..b7ef2e7f4d4a 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -78,7 +78,8 @@ static unsigned int generic_powersave_bias_target(struct cpufreq_policy *policy,
78 unsigned int jiffies_total, jiffies_hi, jiffies_lo; 78 unsigned int jiffies_total, jiffies_hi, jiffies_lo;
79 struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, 79 struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info,
80 policy->cpu); 80 policy->cpu);
81 struct dbs_data *dbs_data = policy->governor_data; 81 struct policy_dbs_info *policy_dbs = policy->governor_data;
82 struct dbs_data *dbs_data = policy_dbs->dbs_data;
82 struct od_dbs_tuners *od_tuners = dbs_data->tuners; 83 struct od_dbs_tuners *od_tuners = dbs_data->tuners;
83 84
84 if (!dbs_info->freq_table) { 85 if (!dbs_info->freq_table) {
@@ -130,7 +131,8 @@ static void ondemand_powersave_bias_init(void)
130 131
131static void dbs_freq_increase(struct cpufreq_policy *policy, unsigned int freq) 132static void dbs_freq_increase(struct cpufreq_policy *policy, unsigned int freq)
132{ 133{
133 struct dbs_data *dbs_data = policy->governor_data; 134 struct policy_dbs_info *policy_dbs = policy->governor_data;
135 struct dbs_data *dbs_data = policy_dbs->dbs_data;
134 struct od_dbs_tuners *od_tuners = dbs_data->tuners; 136 struct od_dbs_tuners *od_tuners = dbs_data->tuners;
135 137
136 if (od_tuners->powersave_bias) 138 if (od_tuners->powersave_bias)
@@ -151,8 +153,9 @@ static void dbs_freq_increase(struct cpufreq_policy *policy, unsigned int freq)
151static void od_check_cpu(int cpu, unsigned int load) 153static void od_check_cpu(int cpu, unsigned int load)
152{ 154{
153 struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu); 155 struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, cpu);
154 struct cpufreq_policy *policy = dbs_info->cdbs.policy_dbs->policy; 156 struct policy_dbs_info *policy_dbs = dbs_info->cdbs.policy_dbs;
155 struct dbs_data *dbs_data = policy->governor_data; 157 struct cpufreq_policy *policy = policy_dbs->policy;
158 struct dbs_data *dbs_data = policy_dbs->dbs_data;
156 struct od_dbs_tuners *od_tuners = dbs_data->tuners; 159 struct od_dbs_tuners *od_tuners = dbs_data->tuners;
157 160
158 dbs_info->freq_lo = 0; 161 dbs_info->freq_lo = 0;
@@ -189,7 +192,8 @@ static void od_check_cpu(int cpu, unsigned int load)
189 192
190static unsigned int od_dbs_timer(struct cpufreq_policy *policy) 193static unsigned int od_dbs_timer(struct cpufreq_policy *policy)
191{ 194{
192 struct dbs_data *dbs_data = policy->governor_data; 195 struct policy_dbs_info *policy_dbs = policy->governor_data;
196 struct dbs_data *dbs_data = policy_dbs->dbs_data;
193 struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, policy->cpu); 197 struct od_cpu_dbs_info_s *dbs_info = &per_cpu(od_cpu_dbs_info, policy->cpu);
194 struct od_dbs_tuners *od_tuners = dbs_data->tuners; 198 struct od_dbs_tuners *od_tuners = dbs_data->tuners;
195 int delay = 0, sample_type = dbs_info->sample_type; 199 int delay = 0, sample_type = dbs_info->sample_type;
@@ -277,7 +281,7 @@ static void update_sampling_rate(struct dbs_data *dbs_data,
277 * policy will be governed by dbs_data, otherwise there can be 281 * policy will be governed by dbs_data, otherwise there can be
278 * multiple policies that are governed by the same dbs_data. 282 * multiple policies that are governed by the same dbs_data.
279 */ 283 */
280 if (dbs_data == policy->governor_data) { 284 if (dbs_data == policy_dbs->dbs_data) {
281 mutex_lock(&policy_dbs->timer_mutex); 285 mutex_lock(&policy_dbs->timer_mutex);
282 /* 286 /*
283 * On 32-bit architectures this may race with the 287 * On 32-bit architectures this may race with the
@@ -586,7 +590,7 @@ static void od_set_powersave_bias(unsigned int powersave_bias)
586 if (policy->governor != CPU_FREQ_GOV_ONDEMAND) 590 if (policy->governor != CPU_FREQ_GOV_ONDEMAND)
587 continue; 591 continue;
588 592
589 dbs_data = policy->governor_data; 593 dbs_data = policy_dbs->dbs_data;
590 od_tuners = dbs_data->tuners; 594 od_tuners = dbs_data->tuners;
591 od_tuners->powersave_bias = default_powersave_bias; 595 od_tuners->powersave_bias = default_powersave_bias;
592 } 596 }