aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-03-21 21:47:51 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2016-04-01 19:09:00 -0400
commit0dd3c1d678aa219a7332984fcedbdd8970e92d5b (patch)
tree9ac34d05785083187229f0b206cd06f9ded9e5c1
parent0bed612be638e41456cd8cb270a2b411a5b43d63 (diff)
cpufreq: governor: New data type for management part of dbs_data
In addition to fields representing governor tunables, struct dbs_data contains some fields needed for the management of objects of that type. As it turns out, that part of struct dbs_data may be shared with (future) governors that won't use the common code used by "ondemand" and "conservative", so move it to a separate struct type and modify the code using struct dbs_data to follow. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c25
-rw-r--r--drivers/cpufreq/cpufreq_governor.c90
-rw-r--r--drivers/cpufreq/cpufreq_governor.h35
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c29
4 files changed, 107 insertions, 72 deletions
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index bf4913f6453b..316df247e00d 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -129,9 +129,10 @@ static struct notifier_block cs_cpufreq_notifier_block = {
129/************************** sysfs interface ************************/ 129/************************** sysfs interface ************************/
130static struct dbs_governor cs_dbs_gov; 130static struct dbs_governor cs_dbs_gov;
131 131
132static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data, 132static ssize_t store_sampling_down_factor(struct gov_attr_set *attr_set,
133 const char *buf, size_t count) 133 const char *buf, size_t count)
134{ 134{
135 struct dbs_data *dbs_data = to_dbs_data(attr_set);
135 unsigned int input; 136 unsigned int input;
136 int ret; 137 int ret;
137 ret = sscanf(buf, "%u", &input); 138 ret = sscanf(buf, "%u", &input);
@@ -143,9 +144,10 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data,
143 return count; 144 return count;
144} 145}
145 146
146static ssize_t store_up_threshold(struct dbs_data *dbs_data, const char *buf, 147static ssize_t store_up_threshold(struct gov_attr_set *attr_set,
147 size_t count) 148 const char *buf, size_t count)
148{ 149{
150 struct dbs_data *dbs_data = to_dbs_data(attr_set);
149 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; 151 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
150 unsigned int input; 152 unsigned int input;
151 int ret; 153 int ret;
@@ -158,9 +160,10 @@ static ssize_t store_up_threshold(struct dbs_data *dbs_data, const char *buf,
158 return count; 160 return count;
159} 161}
160 162
161static ssize_t store_down_threshold(struct dbs_data *dbs_data, const char *buf, 163static ssize_t store_down_threshold(struct gov_attr_set *attr_set,
162 size_t count) 164 const char *buf, size_t count)
163{ 165{
166 struct dbs_data *dbs_data = to_dbs_data(attr_set);
164 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; 167 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
165 unsigned int input; 168 unsigned int input;
166 int ret; 169 int ret;
@@ -175,9 +178,10 @@ static ssize_t store_down_threshold(struct dbs_data *dbs_data, const char *buf,
175 return count; 178 return count;
176} 179}
177 180
178static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, 181static ssize_t store_ignore_nice_load(struct gov_attr_set *attr_set,
179 const char *buf, size_t count) 182 const char *buf, size_t count)
180{ 183{
184 struct dbs_data *dbs_data = to_dbs_data(attr_set);
181 unsigned int input; 185 unsigned int input;
182 int ret; 186 int ret;
183 187
@@ -199,9 +203,10 @@ static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data,
199 return count; 203 return count;
200} 204}
201 205
202static ssize_t store_freq_step(struct dbs_data *dbs_data, const char *buf, 206static ssize_t store_freq_step(struct gov_attr_set *attr_set, const char *buf,
203 size_t count) 207 size_t count)
204{ 208{
209 struct dbs_data *dbs_data = to_dbs_data(attr_set);
205 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners; 210 struct cs_dbs_tuners *cs_tuners = dbs_data->tuners;
206 unsigned int input; 211 unsigned int input;
207 int ret; 212 int ret;
diff --git a/drivers/cpufreq/cpufreq_governor.c b/drivers/cpufreq/cpufreq_governor.c
index 3a0312f46027..6a565e248ad3 100644
--- a/drivers/cpufreq/cpufreq_governor.c
+++ b/drivers/cpufreq/cpufreq_governor.c
@@ -43,9 +43,10 @@ static DEFINE_MUTEX(gov_dbs_data_mutex);
43 * This must be called with dbs_data->mutex held, otherwise traversing 43 * This must be called with dbs_data->mutex held, otherwise traversing
44 * policy_dbs_list isn't safe. 44 * policy_dbs_list isn't safe.
45 */ 45 */
46ssize_t store_sampling_rate(struct dbs_data *dbs_data, const char *buf, 46ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf,
47 size_t count) 47 size_t count)
48{ 48{
49 struct dbs_data *dbs_data = to_dbs_data(attr_set);
49 struct policy_dbs_info *policy_dbs; 50 struct policy_dbs_info *policy_dbs;
50 unsigned int rate; 51 unsigned int rate;
51 int ret; 52 int ret;
@@ -59,7 +60,7 @@ ssize_t store_sampling_rate(struct dbs_data *dbs_data, const char *buf,
59 * We are operating under dbs_data->mutex and so the list and its 60 * We are operating under dbs_data->mutex and so the list and its
60 * entries can't be freed concurrently. 61 * entries can't be freed concurrently.
61 */ 62 */
62 list_for_each_entry(policy_dbs, &dbs_data->policy_dbs_list, list) { 63 list_for_each_entry(policy_dbs, &attr_set->policy_list, list) {
63 mutex_lock(&policy_dbs->timer_mutex); 64 mutex_lock(&policy_dbs->timer_mutex);
64 /* 65 /*
65 * On 32-bit architectures this may race with the 66 * On 32-bit architectures this may race with the
@@ -96,7 +97,7 @@ void gov_update_cpu_data(struct dbs_data *dbs_data)
96{ 97{
97 struct policy_dbs_info *policy_dbs; 98 struct policy_dbs_info *policy_dbs;
98 99
99 list_for_each_entry(policy_dbs, &dbs_data->policy_dbs_list, list) { 100 list_for_each_entry(policy_dbs, &dbs_data->attr_set.policy_list, list) {
100 unsigned int j; 101 unsigned int j;
101 102
102 for_each_cpu(j, policy_dbs->policy->cpus) { 103 for_each_cpu(j, policy_dbs->policy->cpus) {
@@ -111,9 +112,9 @@ void gov_update_cpu_data(struct dbs_data *dbs_data)
111} 112}
112EXPORT_SYMBOL_GPL(gov_update_cpu_data); 113EXPORT_SYMBOL_GPL(gov_update_cpu_data);
113 114
114static inline struct dbs_data *to_dbs_data(struct kobject *kobj) 115static inline struct gov_attr_set *to_gov_attr_set(struct kobject *kobj)
115{ 116{
116 return container_of(kobj, struct dbs_data, kobj); 117 return container_of(kobj, struct gov_attr_set, kobj);
117} 118}
118 119
119static inline struct governor_attr *to_gov_attr(struct attribute *attr) 120static inline struct governor_attr *to_gov_attr(struct attribute *attr)
@@ -124,25 +125,24 @@ static inline struct governor_attr *to_gov_attr(struct attribute *attr)
124static ssize_t governor_show(struct kobject *kobj, struct attribute *attr, 125static ssize_t governor_show(struct kobject *kobj, struct attribute *attr,
125 char *buf) 126 char *buf)
126{ 127{
127 struct dbs_data *dbs_data = to_dbs_data(kobj);
128 struct governor_attr *gattr = to_gov_attr(attr); 128 struct governor_attr *gattr = to_gov_attr(attr);
129 129
130 return gattr->show(dbs_data, buf); 130 return gattr->show(to_gov_attr_set(kobj), buf);
131} 131}
132 132
133static ssize_t governor_store(struct kobject *kobj, struct attribute *attr, 133static ssize_t governor_store(struct kobject *kobj, struct attribute *attr,
134 const char *buf, size_t count) 134 const char *buf, size_t count)
135{ 135{
136 struct dbs_data *dbs_data = to_dbs_data(kobj); 136 struct gov_attr_set *attr_set = to_gov_attr_set(kobj);
137 struct governor_attr *gattr = to_gov_attr(attr); 137 struct governor_attr *gattr = to_gov_attr(attr);
138 int ret = -EBUSY; 138 int ret = -EBUSY;
139 139
140 mutex_lock(&dbs_data->mutex); 140 mutex_lock(&attr_set->update_lock);
141 141
142 if (dbs_data->usage_count) 142 if (attr_set->usage_count)
143 ret = gattr->store(dbs_data, buf, count); 143 ret = gattr->store(attr_set, buf, count);
144 144
145 mutex_unlock(&dbs_data->mutex); 145 mutex_unlock(&attr_set->update_lock);
146 146
147 return ret; 147 return ret;
148} 148}
@@ -425,6 +425,41 @@ static void free_policy_dbs_info(struct policy_dbs_info *policy_dbs,
425 gov->free(policy_dbs); 425 gov->free(policy_dbs);
426} 426}
427 427
428static void gov_attr_set_init(struct gov_attr_set *attr_set,
429 struct list_head *list_node)
430{
431 INIT_LIST_HEAD(&attr_set->policy_list);
432 mutex_init(&attr_set->update_lock);
433 attr_set->usage_count = 1;
434 list_add(list_node, &attr_set->policy_list);
435}
436
437static void gov_attr_set_get(struct gov_attr_set *attr_set,
438 struct list_head *list_node)
439{
440 mutex_lock(&attr_set->update_lock);
441 attr_set->usage_count++;
442 list_add(list_node, &attr_set->policy_list);
443 mutex_unlock(&attr_set->update_lock);
444}
445
446static unsigned int gov_attr_set_put(struct gov_attr_set *attr_set,
447 struct list_head *list_node)
448{
449 unsigned int count;
450
451 mutex_lock(&attr_set->update_lock);
452 list_del(list_node);
453 count = --attr_set->usage_count;
454 mutex_unlock(&attr_set->update_lock);
455 if (count)
456 return count;
457
458 kobject_put(&attr_set->kobj);
459 mutex_destroy(&attr_set->update_lock);
460 return 0;
461}
462
428static int cpufreq_governor_init(struct cpufreq_policy *policy) 463static int cpufreq_governor_init(struct cpufreq_policy *policy)
429{ 464{
430 struct dbs_governor *gov = dbs_governor_of(policy); 465 struct dbs_governor *gov = dbs_governor_of(policy);
@@ -453,10 +488,7 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy)
453 policy_dbs->dbs_data = dbs_data; 488 policy_dbs->dbs_data = dbs_data;
454 policy->governor_data = policy_dbs; 489 policy->governor_data = policy_dbs;
455 490
456 mutex_lock(&dbs_data->mutex); 491 gov_attr_set_get(&dbs_data->attr_set, &policy_dbs->list);
457 dbs_data->usage_count++;
458 list_add(&policy_dbs->list, &dbs_data->policy_dbs_list);
459 mutex_unlock(&dbs_data->mutex);
460 goto out; 492 goto out;
461 } 493 }
462 494
@@ -466,8 +498,7 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy)
466 goto free_policy_dbs_info; 498 goto free_policy_dbs_info;
467 } 499 }
468 500
469 INIT_LIST_HEAD(&dbs_data->policy_dbs_list); 501 gov_attr_set_init(&dbs_data->attr_set, &policy_dbs->list);
470 mutex_init(&dbs_data->mutex);
471 502
472 ret = gov->init(dbs_data, !policy->governor->initialized); 503 ret = gov->init(dbs_data, !policy->governor->initialized);
473 if (ret) 504 if (ret)
@@ -487,14 +518,11 @@ static int cpufreq_governor_init(struct cpufreq_policy *policy)
487 if (!have_governor_per_policy()) 518 if (!have_governor_per_policy())
488 gov->gdbs_data = dbs_data; 519 gov->gdbs_data = dbs_data;
489 520
490 policy->governor_data = policy_dbs;
491
492 policy_dbs->dbs_data = dbs_data; 521 policy_dbs->dbs_data = dbs_data;
493 dbs_data->usage_count = 1; 522 policy->governor_data = policy_dbs;
494 list_add(&policy_dbs->list, &dbs_data->policy_dbs_list);
495 523
496 gov->kobj_type.sysfs_ops = &governor_sysfs_ops; 524 gov->kobj_type.sysfs_ops = &governor_sysfs_ops;
497 ret = kobject_init_and_add(&dbs_data->kobj, &gov->kobj_type, 525 ret = kobject_init_and_add(&dbs_data->attr_set.kobj, &gov->kobj_type,
498 get_governor_parent_kobj(policy), 526 get_governor_parent_kobj(policy),
499 "%s", gov->gov.name); 527 "%s", gov->gov.name);
500 if (!ret) 528 if (!ret)
@@ -523,29 +551,21 @@ static int cpufreq_governor_exit(struct cpufreq_policy *policy)
523 struct dbs_governor *gov = dbs_governor_of(policy); 551 struct dbs_governor *gov = dbs_governor_of(policy);
524 struct policy_dbs_info *policy_dbs = policy->governor_data; 552 struct policy_dbs_info *policy_dbs = policy->governor_data;
525 struct dbs_data *dbs_data = policy_dbs->dbs_data; 553 struct dbs_data *dbs_data = policy_dbs->dbs_data;
526 int count; 554 unsigned int count;
527 555
528 /* Protect gov->gdbs_data against concurrent updates. */ 556 /* Protect gov->gdbs_data against concurrent updates. */
529 mutex_lock(&gov_dbs_data_mutex); 557 mutex_lock(&gov_dbs_data_mutex);
530 558
531 mutex_lock(&dbs_data->mutex); 559 count = gov_attr_set_put(&dbs_data->attr_set, &policy_dbs->list);
532 list_del(&policy_dbs->list);
533 count = --dbs_data->usage_count;
534 mutex_unlock(&dbs_data->mutex);
535 560
536 if (!count) { 561 policy->governor_data = NULL;
537 kobject_put(&dbs_data->kobj);
538
539 policy->governor_data = NULL;
540 562
563 if (!count) {
541 if (!have_governor_per_policy()) 564 if (!have_governor_per_policy())
542 gov->gdbs_data = NULL; 565 gov->gdbs_data = NULL;
543 566
544 gov->exit(dbs_data, policy->governor->initialized == 1); 567 gov->exit(dbs_data, policy->governor->initialized == 1);
545 mutex_destroy(&dbs_data->mutex);
546 kfree(dbs_data); 568 kfree(dbs_data);
547 } else {
548 policy->governor_data = NULL;
549 } 569 }
550 570
551 free_policy_dbs_info(policy_dbs, gov); 571 free_policy_dbs_info(policy_dbs, gov);
diff --git a/drivers/cpufreq/cpufreq_governor.h b/drivers/cpufreq/cpufreq_governor.h
index 61ff82fe0613..f4ad431130b8 100644
--- a/drivers/cpufreq/cpufreq_governor.h
+++ b/drivers/cpufreq/cpufreq_governor.h
@@ -41,6 +41,13 @@
41/* Ondemand Sampling types */ 41/* Ondemand Sampling types */
42enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE}; 42enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE};
43 43
44struct gov_attr_set {
45 struct kobject kobj;
46 struct list_head policy_list;
47 struct mutex update_lock;
48 int usage_count;
49};
50
44/* 51/*
45 * Abbreviations: 52 * Abbreviations:
46 * dbs: used as a shortform for demand based switching It helps to keep variable 53 * dbs: used as a shortform for demand based switching It helps to keep variable
@@ -52,7 +59,7 @@ enum {OD_NORMAL_SAMPLE, OD_SUB_SAMPLE};
52 59
53/* Governor demand based switching data (per-policy or global). */ 60/* Governor demand based switching data (per-policy or global). */
54struct dbs_data { 61struct dbs_data {
55 int usage_count; 62 struct gov_attr_set attr_set;
56 void *tuners; 63 void *tuners;
57 unsigned int min_sampling_rate; 64 unsigned int min_sampling_rate;
58 unsigned int ignore_nice_load; 65 unsigned int ignore_nice_load;
@@ -60,37 +67,35 @@ struct dbs_data {
60 unsigned int sampling_down_factor; 67 unsigned int sampling_down_factor;
61 unsigned int up_threshold; 68 unsigned int up_threshold;
62 unsigned int io_is_busy; 69 unsigned int io_is_busy;
63
64 struct kobject kobj;
65 struct list_head policy_dbs_list;
66 /*
67 * Protect concurrent updates to governor tunables from sysfs,
68 * policy_dbs_list and usage_count.
69 */
70 struct mutex mutex;
71}; 70};
72 71
72static inline struct dbs_data *to_dbs_data(struct gov_attr_set *attr_set)
73{
74 return container_of(attr_set, struct dbs_data, attr_set);
75}
76
73/* Governor's specific attributes */ 77/* Governor's specific attributes */
74struct dbs_data;
75struct governor_attr { 78struct governor_attr {
76 struct attribute attr; 79 struct attribute attr;
77 ssize_t (*show)(struct dbs_data *dbs_data, char *buf); 80 ssize_t (*show)(struct gov_attr_set *attr_set, char *buf);
78 ssize_t (*store)(struct dbs_data *dbs_data, const char *buf, 81 ssize_t (*store)(struct gov_attr_set *attr_set, const char *buf,
79 size_t count); 82 size_t count);
80}; 83};
81 84
82#define gov_show_one(_gov, file_name) \ 85#define gov_show_one(_gov, file_name) \
83static ssize_t show_##file_name \ 86static ssize_t show_##file_name \
84(struct dbs_data *dbs_data, char *buf) \ 87(struct gov_attr_set *attr_set, char *buf) \
85{ \ 88{ \
89 struct dbs_data *dbs_data = to_dbs_data(attr_set); \
86 struct _gov##_dbs_tuners *tuners = dbs_data->tuners; \ 90 struct _gov##_dbs_tuners *tuners = dbs_data->tuners; \
87 return sprintf(buf, "%u\n", tuners->file_name); \ 91 return sprintf(buf, "%u\n", tuners->file_name); \
88} 92}
89 93
90#define gov_show_one_common(file_name) \ 94#define gov_show_one_common(file_name) \
91static ssize_t show_##file_name \ 95static ssize_t show_##file_name \
92(struct dbs_data *dbs_data, char *buf) \ 96(struct gov_attr_set *attr_set, char *buf) \
93{ \ 97{ \
98 struct dbs_data *dbs_data = to_dbs_data(attr_set); \
94 return sprintf(buf, "%u\n", dbs_data->file_name); \ 99 return sprintf(buf, "%u\n", dbs_data->file_name); \
95} 100}
96 101
@@ -184,7 +189,7 @@ void od_register_powersave_bias_handler(unsigned int (*f)
184 (struct cpufreq_policy *, unsigned int, unsigned int), 189 (struct cpufreq_policy *, unsigned int, unsigned int),
185 unsigned int powersave_bias); 190 unsigned int powersave_bias);
186void od_unregister_powersave_bias_handler(void); 191void od_unregister_powersave_bias_handler(void);
187ssize_t store_sampling_rate(struct dbs_data *dbs_data, const char *buf, 192ssize_t store_sampling_rate(struct gov_attr_set *attr_set, const char *buf,
188 size_t count); 193 size_t count);
189void gov_update_cpu_data(struct dbs_data *dbs_data); 194void gov_update_cpu_data(struct dbs_data *dbs_data);
190#endif /* _CPUFREQ_GOVERNOR_H */ 195#endif /* _CPUFREQ_GOVERNOR_H */
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index acd80272ded6..300163430516 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -207,9 +207,10 @@ static unsigned int od_dbs_timer(struct cpufreq_policy *policy)
207/************************** sysfs interface ************************/ 207/************************** sysfs interface ************************/
208static struct dbs_governor od_dbs_gov; 208static struct dbs_governor od_dbs_gov;
209 209
210static ssize_t store_io_is_busy(struct dbs_data *dbs_data, const char *buf, 210static ssize_t store_io_is_busy(struct gov_attr_set *attr_set, const char *buf,
211 size_t count) 211 size_t count)
212{ 212{
213 struct dbs_data *dbs_data = to_dbs_data(attr_set);
213 unsigned int input; 214 unsigned int input;
214 int ret; 215 int ret;
215 216
@@ -224,9 +225,10 @@ static ssize_t store_io_is_busy(struct dbs_data *dbs_data, const char *buf,
224 return count; 225 return count;
225} 226}
226 227
227static ssize_t store_up_threshold(struct dbs_data *dbs_data, const char *buf, 228static ssize_t store_up_threshold(struct gov_attr_set *attr_set,
228 size_t count) 229 const char *buf, size_t count)
229{ 230{
231 struct dbs_data *dbs_data = to_dbs_data(attr_set);
230 unsigned int input; 232 unsigned int input;
231 int ret; 233 int ret;
232 ret = sscanf(buf, "%u", &input); 234 ret = sscanf(buf, "%u", &input);
@@ -240,9 +242,10 @@ static ssize_t store_up_threshold(struct dbs_data *dbs_data, const char *buf,
240 return count; 242 return count;
241} 243}
242 244
243static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data, 245static ssize_t store_sampling_down_factor(struct gov_attr_set *attr_set,
244 const char *buf, size_t count) 246 const char *buf, size_t count)
245{ 247{
248 struct dbs_data *dbs_data = to_dbs_data(attr_set);
246 struct policy_dbs_info *policy_dbs; 249 struct policy_dbs_info *policy_dbs;
247 unsigned int input; 250 unsigned int input;
248 int ret; 251 int ret;
@@ -254,7 +257,7 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data,
254 dbs_data->sampling_down_factor = input; 257 dbs_data->sampling_down_factor = input;
255 258
256 /* Reset down sampling multiplier in case it was active */ 259 /* Reset down sampling multiplier in case it was active */
257 list_for_each_entry(policy_dbs, &dbs_data->policy_dbs_list, list) { 260 list_for_each_entry(policy_dbs, &attr_set->policy_list, list) {
258 /* 261 /*
259 * Doing this without locking might lead to using different 262 * Doing this without locking might lead to using different
260 * rate_mult values in od_update() and od_dbs_timer(). 263 * rate_mult values in od_update() and od_dbs_timer().
@@ -267,9 +270,10 @@ static ssize_t store_sampling_down_factor(struct dbs_data *dbs_data,
267 return count; 270 return count;
268} 271}
269 272
270static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data, 273static ssize_t store_ignore_nice_load(struct gov_attr_set *attr_set,
271 const char *buf, size_t count) 274 const char *buf, size_t count)
272{ 275{
276 struct dbs_data *dbs_data = to_dbs_data(attr_set);
273 unsigned int input; 277 unsigned int input;
274 int ret; 278 int ret;
275 279
@@ -291,9 +295,10 @@ static ssize_t store_ignore_nice_load(struct dbs_data *dbs_data,
291 return count; 295 return count;
292} 296}
293 297
294static ssize_t store_powersave_bias(struct dbs_data *dbs_data, const char *buf, 298static ssize_t store_powersave_bias(struct gov_attr_set *attr_set,
295 size_t count) 299 const char *buf, size_t count)
296{ 300{
301 struct dbs_data *dbs_data = to_dbs_data(attr_set);
297 struct od_dbs_tuners *od_tuners = dbs_data->tuners; 302 struct od_dbs_tuners *od_tuners = dbs_data->tuners;
298 struct policy_dbs_info *policy_dbs; 303 struct policy_dbs_info *policy_dbs;
299 unsigned int input; 304 unsigned int input;
@@ -308,7 +313,7 @@ static ssize_t store_powersave_bias(struct dbs_data *dbs_data, const char *buf,
308 313
309 od_tuners->powersave_bias = input; 314 od_tuners->powersave_bias = input;
310 315
311 list_for_each_entry(policy_dbs, &dbs_data->policy_dbs_list, list) 316 list_for_each_entry(policy_dbs, &attr_set->policy_list, list)
312 ondemand_powersave_bias_init(policy_dbs->policy); 317 ondemand_powersave_bias_init(policy_dbs->policy);
313 318
314 return count; 319 return count;