aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cpufreq/cpufreq.c54
-rw-r--r--drivers/cpufreq/cpufreq_ondemand.c86
-rw-r--r--drivers/cpufreq/cpufreq_performance.c2
-rw-r--r--drivers/cpufreq/cpufreq_powersave.c2
-rw-r--r--drivers/cpufreq/cpufreq_stats.c6
-rw-r--r--drivers/cpufreq/cpufreq_userspace.c12
-rw-r--r--drivers/cpufreq/freq_table.c12
7 files changed, 86 insertions, 88 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 9582de1c9cad..cb7d6e0db759 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -5,7 +5,7 @@
5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de> 5 * (C) 2002 - 2003 Dominik Brodowski <linux@brodo.de>
6 * 6 *
7 * Oct 2005 - Ashok Raj <ashok.raj@intel.com> 7 * Oct 2005 - Ashok Raj <ashok.raj@intel.com>
8 * Added handling for CPU hotplug 8 * Added handling for CPU hotplug
9 * 9 *
10 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
@@ -44,8 +44,8 @@ static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event)
44static void handle_update(void *data); 44static void handle_update(void *data);
45 45
46/** 46/**
47 * Two notifier lists: the "policy" list is involved in the 47 * Two notifier lists: the "policy" list is involved in the
48 * validation process for a new CPU frequency policy; the 48 * validation process for a new CPU frequency policy; the
49 * "transition" list for kernel code that needs to handle 49 * "transition" list for kernel code that needs to handle
50 * changes to devices when the CPU clock speed changes. 50 * changes to devices when the CPU clock speed changes.
51 * The mutex locks both lists. 51 * The mutex locks both lists.
@@ -151,7 +151,7 @@ void cpufreq_debug_printk(unsigned int type, const char *prefix, const char *fmt
151 va_list args; 151 va_list args;
152 unsigned int len; 152 unsigned int len;
153 unsigned long flags; 153 unsigned long flags;
154 154
155 WARN_ON(!prefix); 155 WARN_ON(!prefix);
156 if (type & debug) { 156 if (type & debug) {
157 spin_lock_irqsave(&disable_ratelimit_lock, flags); 157 spin_lock_irqsave(&disable_ratelimit_lock, flags);
@@ -198,7 +198,7 @@ static inline void cpufreq_debug_disable_ratelimit(void) { return; }
198 * 198 *
199 * This function alters the system "loops_per_jiffy" for the clock 199 * This function alters the system "loops_per_jiffy" for the clock
200 * speed change. Note that loops_per_jiffy cannot be updated on SMP 200 * speed change. Note that loops_per_jiffy cannot be updated on SMP
201 * systems as each CPU might be scaled differently. So, use the arch 201 * systems as each CPU might be scaled differently. So, use the arch
202 * per-CPU loops_per_jiffy value wherever possible. 202 * per-CPU loops_per_jiffy value wherever possible.
203 */ 203 */
204#ifndef CONFIG_SMP 204#ifndef CONFIG_SMP
@@ -233,7 +233,7 @@ static inline void adjust_jiffies(unsigned long val, struct cpufreq_freqs *ci) {
233 * 233 *
234 * This function calls the transition notifiers and the "adjust_jiffies" 234 * This function calls the transition notifiers and the "adjust_jiffies"
235 * function. It is called twice on all CPU frequency changes that have 235 * function. It is called twice on all CPU frequency changes that have
236 * external effects. 236 * external effects.
237 */ 237 */
238void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state) 238void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
239{ 239{
@@ -251,7 +251,7 @@ void cpufreq_notify_transition(struct cpufreq_freqs *freqs, unsigned int state)
251 switch (state) { 251 switch (state) {
252 252
253 case CPUFREQ_PRECHANGE: 253 case CPUFREQ_PRECHANGE:
254 /* detect if the driver reported a value as "old frequency" 254 /* detect if the driver reported a value as "old frequency"
255 * which is not equal to what the cpufreq core thinks is 255 * which is not equal to what the cpufreq core thinks is
256 * "old frequency". 256 * "old frequency".
257 */ 257 */
@@ -335,11 +335,11 @@ extern struct sysdev_class cpu_sysdev_class;
335 * "unsigned int". 335 * "unsigned int".
336 */ 336 */
337 337
338#define show_one(file_name, object) \ 338#define show_one(file_name, object) \
339static ssize_t show_##file_name \ 339static ssize_t show_##file_name \
340(struct cpufreq_policy * policy, char *buf) \ 340(struct cpufreq_policy * policy, char *buf) \
341{ \ 341{ \
342 return sprintf (buf, "%u\n", policy->object); \ 342 return sprintf (buf, "%u\n", policy->object); \
343} 343}
344 344
345show_one(cpuinfo_min_freq, cpuinfo.min_freq); 345show_one(cpuinfo_min_freq, cpuinfo.min_freq);
@@ -404,8 +404,8 @@ static ssize_t show_scaling_governor (struct cpufreq_policy * policy, char *buf)
404/** 404/**
405 * store_scaling_governor - store policy for the specified CPU 405 * store_scaling_governor - store policy for the specified CPU
406 */ 406 */
407static ssize_t store_scaling_governor (struct cpufreq_policy * policy, 407static ssize_t store_scaling_governor (struct cpufreq_policy * policy,
408 const char *buf, size_t count) 408 const char *buf, size_t count)
409{ 409{
410 unsigned int ret = -EINVAL; 410 unsigned int ret = -EINVAL;
411 char str_governor[16]; 411 char str_governor[16];
@@ -528,7 +528,7 @@ static ssize_t show(struct kobject * kobj, struct attribute * attr ,char * buf)
528 return ret; 528 return ret;
529} 529}
530 530
531static ssize_t store(struct kobject * kobj, struct attribute * attr, 531static ssize_t store(struct kobject * kobj, struct attribute * attr,
532 const char * buf, size_t count) 532 const char * buf, size_t count)
533{ 533{
534 struct cpufreq_policy * policy = to_policy(kobj); 534 struct cpufreq_policy * policy = to_policy(kobj);
@@ -564,7 +564,7 @@ static struct kobj_type ktype_cpufreq = {
564/** 564/**
565 * cpufreq_add_dev - add a CPU device 565 * cpufreq_add_dev - add a CPU device
566 * 566 *
567 * Adds the cpufreq interface for a CPU device. 567 * Adds the cpufreq interface for a CPU device.
568 */ 568 */
569static int cpufreq_add_dev (struct sys_device * sys_dev) 569static int cpufreq_add_dev (struct sys_device * sys_dev)
570{ 570{
@@ -724,7 +724,7 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
724 724
725#ifdef CONFIG_SMP 725#ifdef CONFIG_SMP
726 /* if this isn't the CPU which is the parent of the kobj, we 726 /* if this isn't the CPU which is the parent of the kobj, we
727 * only need to unlink, put and exit 727 * only need to unlink, put and exit
728 */ 728 */
729 if (unlikely(cpu != data->cpu)) { 729 if (unlikely(cpu != data->cpu)) {
730 dprintk("removing link\n"); 730 dprintk("removing link\n");
@@ -740,7 +740,7 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
740 if (!kobject_get(&data->kobj)) { 740 if (!kobject_get(&data->kobj)) {
741 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 741 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
742 cpufreq_debug_enable_ratelimit(); 742 cpufreq_debug_enable_ratelimit();
743 return -EFAULT; 743 return -EFAULT;
744 } 744 }
745 745
746#ifdef CONFIG_SMP 746#ifdef CONFIG_SMP
@@ -783,7 +783,7 @@ static int cpufreq_remove_dev (struct sys_device * sys_dev)
783 kobject_put(&data->kobj); 783 kobject_put(&data->kobj);
784 784
785 /* we need to make sure that the underlying kobj is actually 785 /* we need to make sure that the underlying kobj is actually
786 * not referenced anymore by anybody before we proceed with 786 * not referenced anymore by anybody before we proceed with
787 * unloading. 787 * unloading.
788 */ 788 */
789 dprintk("waiting for dropping of refcount\n"); 789 dprintk("waiting for dropping of refcount\n");
@@ -831,7 +831,7 @@ static void cpufreq_out_of_sync(unsigned int cpu, unsigned int old_freq, unsigne
831} 831}
832 832
833 833
834/** 834/**
835 * cpufreq_quick_get - get the CPU frequency (in kHz) frpm policy->cur 835 * cpufreq_quick_get - get the CPU frequency (in kHz) frpm policy->cur
836 * @cpu: CPU number 836 * @cpu: CPU number
837 * 837 *
@@ -855,7 +855,7 @@ unsigned int cpufreq_quick_get(unsigned int cpu)
855EXPORT_SYMBOL(cpufreq_quick_get); 855EXPORT_SYMBOL(cpufreq_quick_get);
856 856
857 857
858/** 858/**
859 * cpufreq_get - get the current CPU frequency (in kHz) 859 * cpufreq_get - get the current CPU frequency (in kHz)
860 * @cpu: CPU number 860 * @cpu: CPU number
861 * 861 *
@@ -1072,7 +1072,7 @@ static struct sysdev_driver cpufreq_sysdev_driver = {
1072 * @nb: notifier function to register 1072 * @nb: notifier function to register
1073 * @list: CPUFREQ_TRANSITION_NOTIFIER or CPUFREQ_POLICY_NOTIFIER 1073 * @list: CPUFREQ_TRANSITION_NOTIFIER or CPUFREQ_POLICY_NOTIFIER
1074 * 1074 *
1075 * Add a driver to one of two lists: either a list of drivers that 1075 * Add a driver to one of two lists: either a list of drivers that
1076 * are notified about clock rate changes (once before and once after 1076 * are notified about clock rate changes (once before and once after
1077 * the transition), or a list of drivers that are notified about 1077 * the transition), or a list of drivers that are notified about
1078 * changes in cpufreq policy. 1078 * changes in cpufreq policy.
@@ -1225,7 +1225,7 @@ int cpufreq_register_governor(struct cpufreq_governor *governor)
1225 return -EINVAL; 1225 return -EINVAL;
1226 1226
1227 mutex_lock(&cpufreq_governor_mutex); 1227 mutex_lock(&cpufreq_governor_mutex);
1228 1228
1229 list_for_each_entry(t, &cpufreq_governor_list, governor_list) { 1229 list_for_each_entry(t, &cpufreq_governor_list, governor_list) {
1230 if (!strnicmp(governor->name,t->name,CPUFREQ_NAME_LEN)) { 1230 if (!strnicmp(governor->name,t->name,CPUFREQ_NAME_LEN)) {
1231 mutex_unlock(&cpufreq_governor_mutex); 1231 mutex_unlock(&cpufreq_governor_mutex);
@@ -1234,7 +1234,7 @@ int cpufreq_register_governor(struct cpufreq_governor *governor)
1234 } 1234 }
1235 list_add(&governor->governor_list, &cpufreq_governor_list); 1235 list_add(&governor->governor_list, &cpufreq_governor_list);
1236 1236
1237 mutex_unlock(&cpufreq_governor_mutex); 1237 mutex_unlock(&cpufreq_governor_mutex);
1238 return 0; 1238 return 0;
1239} 1239}
1240EXPORT_SYMBOL_GPL(cpufreq_register_governor); 1240EXPORT_SYMBOL_GPL(cpufreq_register_governor);
@@ -1497,9 +1497,9 @@ static struct notifier_block cpufreq_cpu_notifier =
1497 * @driver_data: A struct cpufreq_driver containing the values# 1497 * @driver_data: A struct cpufreq_driver containing the values#
1498 * submitted by the CPU Frequency driver. 1498 * submitted by the CPU Frequency driver.
1499 * 1499 *
1500 * Registers a CPU Frequency driver to this core code. This code 1500 * Registers a CPU Frequency driver to this core code. This code
1501 * returns zero on success, -EBUSY when another driver got here first 1501 * returns zero on success, -EBUSY when another driver got here first
1502 * (and isn't unregistered in the meantime). 1502 * (and isn't unregistered in the meantime).
1503 * 1503 *
1504 */ 1504 */
1505int cpufreq_register_driver(struct cpufreq_driver *driver_data) 1505int cpufreq_register_driver(struct cpufreq_driver *driver_data)
@@ -1560,7 +1560,7 @@ EXPORT_SYMBOL_GPL(cpufreq_register_driver);
1560/** 1560/**
1561 * cpufreq_unregister_driver - unregister the current CPUFreq driver 1561 * cpufreq_unregister_driver - unregister the current CPUFreq driver
1562 * 1562 *
1563 * Unregister the current CPUFreq driver. Only call this if you have 1563 * Unregister the current CPUFreq driver. Only call this if you have
1564 * the right to do so, i.e. if you have succeeded in initialising before! 1564 * the right to do so, i.e. if you have succeeded in initialising before!
1565 * Returns zero if successful, and -EINVAL if the cpufreq_driver is 1565 * Returns zero if successful, and -EINVAL if the cpufreq_driver is
1566 * currently not initialised. 1566 * currently not initialised.
diff --git a/drivers/cpufreq/cpufreq_ondemand.c b/drivers/cpufreq/cpufreq_ondemand.c
index 9ee9411f186f..69aa1db8336c 100644
--- a/drivers/cpufreq/cpufreq_ondemand.c
+++ b/drivers/cpufreq/cpufreq_ondemand.c
@@ -38,17 +38,17 @@
38#define MIN_FREQUENCY_UP_THRESHOLD (11) 38#define MIN_FREQUENCY_UP_THRESHOLD (11)
39#define MAX_FREQUENCY_UP_THRESHOLD (100) 39#define MAX_FREQUENCY_UP_THRESHOLD (100)
40 40
41/* 41/*
42 * The polling frequency of this governor depends on the capability of 42 * The polling frequency of this governor depends on the capability of
43 * the processor. Default polling frequency is 1000 times the transition 43 * the processor. Default polling frequency is 1000 times the transition
44 * latency of the processor. The governor will work on any processor with 44 * latency of the processor. The governor will work on any processor with
45 * transition latency <= 10mS, using appropriate sampling 45 * transition latency <= 10mS, using appropriate sampling
46 * rate. 46 * rate.
47 * For CPUs with transition latency > 10mS (mostly drivers with CPUFREQ_ETERNAL) 47 * For CPUs with transition latency > 10mS (mostly drivers with CPUFREQ_ETERNAL)
48 * this governor will not work. 48 * this governor will not work.
49 * All times here are in uS. 49 * All times here are in uS.
50 */ 50 */
51static unsigned int def_sampling_rate; 51static unsigned int def_sampling_rate;
52#define MIN_SAMPLING_RATE_RATIO (2) 52#define MIN_SAMPLING_RATE_RATIO (2)
53/* for correct statistics, we need at least 10 ticks between each measure */ 53/* for correct statistics, we need at least 10 ticks between each measure */
54#define MIN_STAT_SAMPLING_RATE (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10)) 54#define MIN_STAT_SAMPLING_RATE (MIN_SAMPLING_RATE_RATIO * jiffies_to_usecs(10))
@@ -62,28 +62,28 @@ static unsigned int def_sampling_rate;
62static void do_dbs_timer(void *data); 62static void do_dbs_timer(void *data);
63 63
64struct cpu_dbs_info_s { 64struct cpu_dbs_info_s {
65 struct cpufreq_policy *cur_policy; 65 struct cpufreq_policy *cur_policy;
66 unsigned int prev_cpu_idle_up; 66 unsigned int prev_cpu_idle_up;
67 unsigned int prev_cpu_idle_down; 67 unsigned int prev_cpu_idle_down;
68 unsigned int enable; 68 unsigned int enable;
69}; 69};
70static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info); 70static DEFINE_PER_CPU(struct cpu_dbs_info_s, cpu_dbs_info);
71 71
72static unsigned int dbs_enable; /* number of CPUs using this policy */ 72static unsigned int dbs_enable; /* number of CPUs using this policy */
73 73
74static DEFINE_MUTEX (dbs_mutex); 74static DEFINE_MUTEX (dbs_mutex);
75static DECLARE_WORK (dbs_work, do_dbs_timer, NULL); 75static DECLARE_WORK (dbs_work, do_dbs_timer, NULL);
76 76
77struct dbs_tuners { 77struct dbs_tuners {
78 unsigned int sampling_rate; 78 unsigned int sampling_rate;
79 unsigned int sampling_down_factor; 79 unsigned int sampling_down_factor;
80 unsigned int up_threshold; 80 unsigned int up_threshold;
81 unsigned int ignore_nice; 81 unsigned int ignore_nice;
82}; 82};
83 83
84static struct dbs_tuners dbs_tuners_ins = { 84static struct dbs_tuners dbs_tuners_ins = {
85 .up_threshold = DEF_FREQUENCY_UP_THRESHOLD, 85 .up_threshold = DEF_FREQUENCY_UP_THRESHOLD,
86 .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR, 86 .sampling_down_factor = DEF_SAMPLING_DOWN_FACTOR,
87}; 87};
88 88
89static inline unsigned int get_cpu_idle_time(unsigned int cpu) 89static inline unsigned int get_cpu_idle_time(unsigned int cpu)
@@ -106,8 +106,8 @@ static ssize_t show_sampling_rate_min(struct cpufreq_policy *policy, char *buf)
106 return sprintf (buf, "%u\n", MIN_SAMPLING_RATE); 106 return sprintf (buf, "%u\n", MIN_SAMPLING_RATE);
107} 107}
108 108
109#define define_one_ro(_name) \ 109#define define_one_ro(_name) \
110static struct freq_attr _name = \ 110static struct freq_attr _name = \
111__ATTR(_name, 0444, show_##_name, NULL) 111__ATTR(_name, 0444, show_##_name, NULL)
112 112
113define_one_ro(sampling_rate_max); 113define_one_ro(sampling_rate_max);
@@ -125,7 +125,7 @@ show_one(sampling_down_factor, sampling_down_factor);
125show_one(up_threshold, up_threshold); 125show_one(up_threshold, up_threshold);
126show_one(ignore_nice_load, ignore_nice); 126show_one(ignore_nice_load, ignore_nice);
127 127
128static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused, 128static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused,
129 const char *buf, size_t count) 129 const char *buf, size_t count)
130{ 130{
131 unsigned int input; 131 unsigned int input;
@@ -144,7 +144,7 @@ static ssize_t store_sampling_down_factor(struct cpufreq_policy *unused,
144 return count; 144 return count;
145} 145}
146 146
147static ssize_t store_sampling_rate(struct cpufreq_policy *unused, 147static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
148 const char *buf, size_t count) 148 const char *buf, size_t count)
149{ 149{
150 unsigned int input; 150 unsigned int input;
@@ -163,7 +163,7 @@ static ssize_t store_sampling_rate(struct cpufreq_policy *unused,
163 return count; 163 return count;
164} 164}
165 165
166static ssize_t store_up_threshold(struct cpufreq_policy *unused, 166static ssize_t store_up_threshold(struct cpufreq_policy *unused,
167 const char *buf, size_t count) 167 const char *buf, size_t count)
168{ 168{
169 unsigned int input; 169 unsigned int input;
@@ -171,7 +171,7 @@ static ssize_t store_up_threshold(struct cpufreq_policy *unused,
171 ret = sscanf (buf, "%u", &input); 171 ret = sscanf (buf, "%u", &input);
172 172
173 mutex_lock(&dbs_mutex); 173 mutex_lock(&dbs_mutex);
174 if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD || 174 if (ret != 1 || input > MAX_FREQUENCY_UP_THRESHOLD ||
175 input < MIN_FREQUENCY_UP_THRESHOLD) { 175 input < MIN_FREQUENCY_UP_THRESHOLD) {
176 mutex_unlock(&dbs_mutex); 176 mutex_unlock(&dbs_mutex);
177 return -EINVAL; 177 return -EINVAL;
@@ -190,14 +190,14 @@ static ssize_t store_ignore_nice_load(struct cpufreq_policy *policy,
190 int ret; 190 int ret;
191 191
192 unsigned int j; 192 unsigned int j;
193 193
194 ret = sscanf (buf, "%u", &input); 194 ret = sscanf (buf, "%u", &input);
195 if ( ret != 1 ) 195 if ( ret != 1 )
196 return -EINVAL; 196 return -EINVAL;
197 197
198 if ( input > 1 ) 198 if ( input > 1 )
199 input = 1; 199 input = 1;
200 200
201 mutex_lock(&dbs_mutex); 201 mutex_lock(&dbs_mutex);
202 if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */ 202 if ( input == dbs_tuners_ins.ignore_nice ) { /* nothing to do */
203 mutex_unlock(&dbs_mutex); 203 mutex_unlock(&dbs_mutex);
@@ -259,16 +259,16 @@ static void dbs_check_cpu(int cpu)
259 return; 259 return;
260 260
261 policy = this_dbs_info->cur_policy; 261 policy = this_dbs_info->cur_policy;
262 /* 262 /*
263 * Every sampling_rate, we check, if current idle time is less 263 * Every sampling_rate, we check, if current idle time is less
264 * than 20% (default), then we try to increase frequency 264 * than 20% (default), then we try to increase frequency
265 * Every sampling_rate*sampling_down_factor, we look for a the lowest 265 * Every sampling_rate*sampling_down_factor, we look for a the lowest
266 * frequency which can sustain the load while keeping idle time over 266 * frequency which can sustain the load while keeping idle time over
267 * 30%. If such a frequency exist, we try to decrease to this frequency. 267 * 30%. If such a frequency exist, we try to decrease to this frequency.
268 * 268 *
269 * Any frequency increase takes it to the maximum frequency. 269 * Any frequency increase takes it to the maximum frequency.
270 * Frequency reduction happens at minimum steps of 270 * Frequency reduction happens at minimum steps of
271 * 5% (default) of current frequency 271 * 5% (default) of current frequency
272 */ 272 */
273 273
274 /* Check for frequency increase */ 274 /* Check for frequency increase */
@@ -298,14 +298,14 @@ static void dbs_check_cpu(int cpu)
298 struct cpu_dbs_info_s *j_dbs_info; 298 struct cpu_dbs_info_s *j_dbs_info;
299 299
300 j_dbs_info = &per_cpu(cpu_dbs_info, j); 300 j_dbs_info = &per_cpu(cpu_dbs_info, j);
301 j_dbs_info->prev_cpu_idle_down = 301 j_dbs_info->prev_cpu_idle_down =
302 j_dbs_info->prev_cpu_idle_up; 302 j_dbs_info->prev_cpu_idle_up;
303 } 303 }
304 /* if we are already at full speed then break out early */ 304 /* if we are already at full speed then break out early */
305 if (policy->cur == policy->max) 305 if (policy->cur == policy->max)
306 return; 306 return;
307 307
308 __cpufreq_driver_target(policy, policy->max, 308 __cpufreq_driver_target(policy, policy->max,
309 CPUFREQ_RELATION_H); 309 CPUFREQ_RELATION_H);
310 return; 310 return;
311 } 311 }
@@ -347,7 +347,7 @@ static void dbs_check_cpu(int cpu)
347 * policy. To be safe, we focus 10 points under the threshold. 347 * policy. To be safe, we focus 10 points under the threshold.
348 */ 348 */
349 freq_next = ((total_ticks - idle_ticks) * 100) / total_ticks; 349 freq_next = ((total_ticks - idle_ticks) * 100) / total_ticks;
350 freq_next = (freq_next * policy->cur) / 350 freq_next = (freq_next * policy->cur) /
351 (dbs_tuners_ins.up_threshold - 10); 351 (dbs_tuners_ins.up_threshold - 10);
352 352
353 if (freq_next <= ((policy->cur * 95) / 100)) 353 if (freq_next <= ((policy->cur * 95) / 100))
@@ -355,15 +355,15 @@ static void dbs_check_cpu(int cpu)
355} 355}
356 356
357static void do_dbs_timer(void *data) 357static void do_dbs_timer(void *data)
358{ 358{
359 int i; 359 int i;
360 mutex_lock(&dbs_mutex); 360 mutex_lock(&dbs_mutex);
361 for_each_online_cpu(i) 361 for_each_online_cpu(i)
362 dbs_check_cpu(i); 362 dbs_check_cpu(i);
363 schedule_delayed_work(&dbs_work, 363 schedule_delayed_work(&dbs_work,
364 usecs_to_jiffies(dbs_tuners_ins.sampling_rate)); 364 usecs_to_jiffies(dbs_tuners_ins.sampling_rate));
365 mutex_unlock(&dbs_mutex); 365 mutex_unlock(&dbs_mutex);
366} 366}
367 367
368static inline void dbs_timer_init(void) 368static inline void dbs_timer_init(void)
369{ 369{
@@ -390,7 +390,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
390 390
391 switch (event) { 391 switch (event) {
392 case CPUFREQ_GOV_START: 392 case CPUFREQ_GOV_START:
393 if ((!cpu_online(cpu)) || 393 if ((!cpu_online(cpu)) ||
394 (!policy->cur)) 394 (!policy->cur))
395 return -EINVAL; 395 return -EINVAL;
396 396
@@ -399,13 +399,13 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
399 return -EINVAL; 399 return -EINVAL;
400 if (this_dbs_info->enable) /* Already enabled */ 400 if (this_dbs_info->enable) /* Already enabled */
401 break; 401 break;
402 402
403 mutex_lock(&dbs_mutex); 403 mutex_lock(&dbs_mutex);
404 for_each_cpu_mask(j, policy->cpus) { 404 for_each_cpu_mask(j, policy->cpus) {
405 struct cpu_dbs_info_s *j_dbs_info; 405 struct cpu_dbs_info_s *j_dbs_info;
406 j_dbs_info = &per_cpu(cpu_dbs_info, j); 406 j_dbs_info = &per_cpu(cpu_dbs_info, j);
407 j_dbs_info->cur_policy = policy; 407 j_dbs_info->cur_policy = policy;
408 408
409 j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j); 409 j_dbs_info->prev_cpu_idle_up = get_cpu_idle_time(j);
410 j_dbs_info->prev_cpu_idle_down 410 j_dbs_info->prev_cpu_idle_down
411 = j_dbs_info->prev_cpu_idle_up; 411 = j_dbs_info->prev_cpu_idle_up;
@@ -435,7 +435,7 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
435 435
436 dbs_timer_init(); 436 dbs_timer_init();
437 } 437 }
438 438
439 mutex_unlock(&dbs_mutex); 439 mutex_unlock(&dbs_mutex);
440 break; 440 break;
441 441
@@ -448,9 +448,9 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
448 * Stop the timerschedule work, when this governor 448 * Stop the timerschedule work, when this governor
449 * is used for first time 449 * is used for first time
450 */ 450 */
451 if (dbs_enable == 0) 451 if (dbs_enable == 0)
452 dbs_timer_exit(); 452 dbs_timer_exit();
453 453
454 mutex_unlock(&dbs_mutex); 454 mutex_unlock(&dbs_mutex);
455 455
456 break; 456 break;
@@ -460,11 +460,11 @@ static int cpufreq_governor_dbs(struct cpufreq_policy *policy,
460 if (policy->max < this_dbs_info->cur_policy->cur) 460 if (policy->max < this_dbs_info->cur_policy->cur)
461 __cpufreq_driver_target( 461 __cpufreq_driver_target(
462 this_dbs_info->cur_policy, 462 this_dbs_info->cur_policy,
463 policy->max, CPUFREQ_RELATION_H); 463 policy->max, CPUFREQ_RELATION_H);
464 else if (policy->min > this_dbs_info->cur_policy->cur) 464 else if (policy->min > this_dbs_info->cur_policy->cur)
465 __cpufreq_driver_target( 465 __cpufreq_driver_target(
466 this_dbs_info->cur_policy, 466 this_dbs_info->cur_policy,
467 policy->min, CPUFREQ_RELATION_L); 467 policy->min, CPUFREQ_RELATION_L);
468 mutex_unlock(&dbs_mutex); 468 mutex_unlock(&dbs_mutex);
469 break; 469 break;
470 } 470 }
diff --git a/drivers/cpufreq/cpufreq_performance.c b/drivers/cpufreq/cpufreq_performance.c
index 8d536b40deb8..de91e3371ef8 100644
--- a/drivers/cpufreq/cpufreq_performance.c
+++ b/drivers/cpufreq/cpufreq_performance.c
@@ -32,7 +32,7 @@ static int cpufreq_governor_performance(struct cpufreq_policy *policy,
32 } 32 }
33 return 0; 33 return 0;
34} 34}
35 35
36struct cpufreq_governor cpufreq_gov_performance = { 36struct cpufreq_governor cpufreq_gov_performance = {
37 .name = "performance", 37 .name = "performance",
38 .governor = cpufreq_governor_performance, 38 .governor = cpufreq_governor_performance,
diff --git a/drivers/cpufreq/cpufreq_powersave.c b/drivers/cpufreq/cpufreq_powersave.c
index c85edda7feb0..0a2596044e65 100644
--- a/drivers/cpufreq/cpufreq_powersave.c
+++ b/drivers/cpufreq/cpufreq_powersave.c
@@ -31,7 +31,7 @@ static int cpufreq_governor_powersave(struct cpufreq_policy *policy,
31 } 31 }
32 return 0; 32 return 0;
33} 33}
34 34
35static struct cpufreq_governor cpufreq_gov_powersave = { 35static struct cpufreq_governor cpufreq_gov_powersave = {
36 .name = "powersave", 36 .name = "powersave",
37 .governor = cpufreq_governor_powersave, 37 .governor = cpufreq_governor_powersave,
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index 0bddb8e694d9..c25bdb7aec51 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -2,7 +2,7 @@
2 * drivers/cpufreq/cpufreq_stats.c 2 * drivers/cpufreq/cpufreq_stats.c
3 * 3 *
4 * Copyright (C) 2003-2004 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>. 4 * Copyright (C) 2003-2004 Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>.
5 * (C) 2004 Zou Nan hai <nanhai.zou@intel.com>. 5 * (C) 2004 Zou Nan hai <nanhai.zou@intel.com>.
6 * 6 *
7 * This program is free software; you can redistribute it and/or modify 7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
@@ -90,7 +90,7 @@ show_time_in_state(struct cpufreq_policy *policy, char *buf)
90 return 0; 90 return 0;
91 cpufreq_stats_update(stat->cpu); 91 cpufreq_stats_update(stat->cpu);
92 for (i = 0; i < stat->state_num; i++) { 92 for (i = 0; i < stat->state_num; i++) {
93 len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i], 93 len += sprintf(buf + len, "%u %llu\n", stat->freq_table[i],
94 (unsigned long long)cputime64_to_clock_t(stat->time_in_state[i])); 94 (unsigned long long)cputime64_to_clock_t(stat->time_in_state[i]));
95 } 95 }
96 return len; 96 return len;
@@ -171,7 +171,7 @@ cpufreq_stats_free_table (unsigned int cpu)
171{ 171{
172 struct cpufreq_stats *stat = cpufreq_stats_table[cpu]; 172 struct cpufreq_stats *stat = cpufreq_stats_table[cpu];
173 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu); 173 struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
174 if (policy && policy->cpu == cpu) 174 if (policy && policy->cpu == cpu)
175 sysfs_remove_group(&policy->kobj, &stats_attr_group); 175 sysfs_remove_group(&policy->kobj, &stats_attr_group);
176 if (stat) { 176 if (stat) {
177 kfree(stat->time_in_state); 177 kfree(stat->time_in_state);
diff --git a/drivers/cpufreq/cpufreq_userspace.c b/drivers/cpufreq/cpufreq_userspace.c
index 92a0be22a2a9..071ee4f1bbf2 100644
--- a/drivers/cpufreq/cpufreq_userspace.c
+++ b/drivers/cpufreq/cpufreq_userspace.c
@@ -41,7 +41,7 @@ static DEFINE_MUTEX (userspace_mutex);
41#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "userspace", msg) 41#define dprintk(msg...) cpufreq_debug_printk(CPUFREQ_DEBUG_GOVERNOR, "userspace", msg)
42 42
43/* keep track of frequency transitions */ 43/* keep track of frequency transitions */
44static int 44static int
45userspace_cpufreq_notifier(struct notifier_block *nb, unsigned long val, 45userspace_cpufreq_notifier(struct notifier_block *nb, unsigned long val,
46 void *data) 46 void *data)
47{ 47{
@@ -58,7 +58,7 @@ static struct notifier_block userspace_cpufreq_notifier_block = {
58}; 58};
59 59
60 60
61/** 61/**
62 * cpufreq_set - set the CPU frequency 62 * cpufreq_set - set the CPU frequency
63 * @freq: target frequency in kHz 63 * @freq: target frequency in kHz
64 * @cpu: CPU for which the frequency is to be set 64 * @cpu: CPU for which the frequency is to be set
@@ -103,8 +103,8 @@ static ssize_t show_speed (struct cpufreq_policy *policy, char *buf)
103 return sprintf (buf, "%u\n", cpu_cur_freq[policy->cpu]); 103 return sprintf (buf, "%u\n", cpu_cur_freq[policy->cpu]);
104} 104}
105 105
106static ssize_t 106static ssize_t
107store_speed (struct cpufreq_policy *policy, const char *buf, size_t count) 107store_speed (struct cpufreq_policy *policy, const char *buf, size_t count)
108{ 108{
109 unsigned int freq = 0; 109 unsigned int freq = 0;
110 unsigned int ret; 110 unsigned int ret;
@@ -118,7 +118,7 @@ store_speed (struct cpufreq_policy *policy, const char *buf, size_t count)
118 return count; 118 return count;
119} 119}
120 120
121static struct freq_attr freq_attr_scaling_setspeed = 121static struct freq_attr freq_attr_scaling_setspeed =
122{ 122{
123 .attr = { .name = "scaling_setspeed", .mode = 0644, .owner = THIS_MODULE }, 123 .attr = { .name = "scaling_setspeed", .mode = 0644, .owner = THIS_MODULE },
124 .show = show_speed, 124 .show = show_speed,
@@ -135,7 +135,7 @@ static int cpufreq_governor_userspace(struct cpufreq_policy *policy,
135 return -EINVAL; 135 return -EINVAL;
136 BUG_ON(!policy->cur); 136 BUG_ON(!policy->cur);
137 mutex_lock(&userspace_mutex); 137 mutex_lock(&userspace_mutex);
138 cpu_is_managed[cpu] = 1; 138 cpu_is_managed[cpu] = 1;
139 cpu_min_freq[cpu] = policy->min; 139 cpu_min_freq[cpu] = policy->min;
140 cpu_max_freq[cpu] = policy->max; 140 cpu_max_freq[cpu] = policy->max;
141 cpu_cur_freq[cpu] = policy->cur; 141 cpu_cur_freq[cpu] = policy->cur;
diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c
index ba460bdea60f..a4818ce88919 100644
--- a/drivers/cpufreq/freq_table.c
+++ b/drivers/cpufreq/freq_table.c
@@ -59,9 +59,8 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
59 if (!cpu_online(policy->cpu)) 59 if (!cpu_online(policy->cpu))
60 return -EINVAL; 60 return -EINVAL;
61 61
62 cpufreq_verify_within_limits(policy, 62 cpufreq_verify_within_limits(policy,
63 policy->cpuinfo.min_freq, 63 policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
64 policy->cpuinfo.max_freq);
65 64
66 for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) { 65 for (i=0; (table[i].frequency != CPUFREQ_TABLE_END); i++) {
67 unsigned int freq = table[i].frequency; 66 unsigned int freq = table[i].frequency;
@@ -76,9 +75,8 @@ int cpufreq_frequency_table_verify(struct cpufreq_policy *policy,
76 if (!count) 75 if (!count)
77 policy->max = next_larger; 76 policy->max = next_larger;
78 77
79 cpufreq_verify_within_limits(policy, 78 cpufreq_verify_within_limits(policy,
80 policy->cpuinfo.min_freq, 79 policy->cpuinfo.min_freq, policy->cpuinfo.max_freq);
81 policy->cpuinfo.max_freq);
82 80
83 dprintk("verification lead to (%u - %u kHz) for cpu %u\n", policy->min, policy->max, policy->cpu); 81 dprintk("verification lead to (%u - %u kHz) for cpu %u\n", policy->min, policy->max, policy->cpu);
84 82
@@ -199,7 +197,7 @@ EXPORT_SYMBOL_GPL(cpufreq_freq_attr_scaling_available_freqs);
199 * if you use these, you must assure that the frequency table is valid 197 * if you use these, you must assure that the frequency table is valid
200 * all the time between get_attr and put_attr! 198 * all the time between get_attr and put_attr!
201 */ 199 */
202void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table, 200void cpufreq_frequency_table_get_attr(struct cpufreq_frequency_table *table,
203 unsigned int cpu) 201 unsigned int cpu)
204{ 202{
205 dprintk("setting show_table for cpu %u to %p\n", cpu, table); 203 dprintk("setting show_table for cpu %u to %p\n", cpu, table);