aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c19
-rw-r--r--drivers/cpufreq/cpufreq_conservative.c8
-rw-r--r--drivers/cpufreq/cpufreq_stats.c1
3 files changed, 21 insertions, 7 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index e02e4174c2c8..063b2184caf5 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1101,6 +1101,8 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1101 unsigned int cpu = sys_dev->id; 1101 unsigned int cpu = sys_dev->id;
1102 unsigned long flags; 1102 unsigned long flags;
1103 struct cpufreq_policy *data; 1103 struct cpufreq_policy *data;
1104 struct kobject *kobj;
1105 struct completion *cmp;
1104#ifdef CONFIG_SMP 1106#ifdef CONFIG_SMP
1105 struct sys_device *cpu_sys_dev; 1107 struct sys_device *cpu_sys_dev;
1106 unsigned int j; 1108 unsigned int j;
@@ -1129,10 +1131,11 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1129 dprintk("removing link\n"); 1131 dprintk("removing link\n");
1130 cpumask_clear_cpu(cpu, data->cpus); 1132 cpumask_clear_cpu(cpu, data->cpus);
1131 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1133 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1132 sysfs_remove_link(&sys_dev->kobj, "cpufreq"); 1134 kobj = &sys_dev->kobj;
1133 cpufreq_cpu_put(data); 1135 cpufreq_cpu_put(data);
1134 cpufreq_debug_enable_ratelimit(); 1136 cpufreq_debug_enable_ratelimit();
1135 unlock_policy_rwsem_write(cpu); 1137 unlock_policy_rwsem_write(cpu);
1138 sysfs_remove_link(kobj, "cpufreq");
1136 return 0; 1139 return 0;
1137 } 1140 }
1138#endif 1141#endif
@@ -1169,7 +1172,10 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1169 data->governor->name, CPUFREQ_NAME_LEN); 1172 data->governor->name, CPUFREQ_NAME_LEN);
1170#endif 1173#endif
1171 cpu_sys_dev = get_cpu_sysdev(j); 1174 cpu_sys_dev = get_cpu_sysdev(j);
1172 sysfs_remove_link(&cpu_sys_dev->kobj, "cpufreq"); 1175 kobj = &cpu_sys_dev->kobj;
1176 unlock_policy_rwsem_write(cpu);
1177 sysfs_remove_link(kobj, "cpufreq");
1178 lock_policy_rwsem_write(cpu);
1173 cpufreq_cpu_put(data); 1179 cpufreq_cpu_put(data);
1174 } 1180 }
1175 } 1181 }
@@ -1180,19 +1186,22 @@ static int __cpufreq_remove_dev(struct sys_device *sys_dev)
1180 if (cpufreq_driver->target) 1186 if (cpufreq_driver->target)
1181 __cpufreq_governor(data, CPUFREQ_GOV_STOP); 1187 __cpufreq_governor(data, CPUFREQ_GOV_STOP);
1182 1188
1183 kobject_put(&data->kobj); 1189 kobj = &data->kobj;
1190 cmp = &data->kobj_unregister;
1191 unlock_policy_rwsem_write(cpu);
1192 kobject_put(kobj);
1184 1193
1185 /* we need to make sure that the underlying kobj is actually 1194 /* we need to make sure that the underlying kobj is actually
1186 * not referenced anymore by anybody before we proceed with 1195 * not referenced anymore by anybody before we proceed with
1187 * unloading. 1196 * unloading.
1188 */ 1197 */
1189 dprintk("waiting for dropping of refcount\n"); 1198 dprintk("waiting for dropping of refcount\n");
1190 wait_for_completion(&data->kobj_unregister); 1199 wait_for_completion(cmp);
1191 dprintk("wait complete\n"); 1200 dprintk("wait complete\n");
1192 1201
1202 lock_policy_rwsem_write(cpu);
1193 if (cpufreq_driver->exit) 1203 if (cpufreq_driver->exit)
1194 cpufreq_driver->exit(data); 1204 cpufreq_driver->exit(data);
1195
1196 unlock_policy_rwsem_write(cpu); 1205 unlock_policy_rwsem_write(cpu);
1197 1206
1198 free_cpumask_var(data->related_cpus); 1207 free_cpumask_var(data->related_cpus);
diff --git a/drivers/cpufreq/cpufreq_conservative.c b/drivers/cpufreq/cpufreq_conservative.c
index ce5248e04218..526bfbf69611 100644
--- a/drivers/cpufreq/cpufreq_conservative.c
+++ b/drivers/cpufreq/cpufreq_conservative.c
@@ -428,6 +428,7 @@ static struct attribute_group dbs_attr_group_old = {
428static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info) 428static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
429{ 429{
430 unsigned int load = 0; 430 unsigned int load = 0;
431 unsigned int max_load = 0;
431 unsigned int freq_target; 432 unsigned int freq_target;
432 433
433 struct cpufreq_policy *policy; 434 struct cpufreq_policy *policy;
@@ -485,6 +486,9 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
485 continue; 486 continue;
486 487
487 load = 100 * (wall_time - idle_time) / wall_time; 488 load = 100 * (wall_time - idle_time) / wall_time;
489
490 if (load > max_load)
491 max_load = load;
488 } 492 }
489 493
490 /* 494 /*
@@ -495,7 +499,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
495 return; 499 return;
496 500
497 /* Check for frequency increase */ 501 /* Check for frequency increase */
498 if (load > dbs_tuners_ins.up_threshold) { 502 if (max_load > dbs_tuners_ins.up_threshold) {
499 this_dbs_info->down_skip = 0; 503 this_dbs_info->down_skip = 0;
500 504
501 /* if we are already at full speed then break out early */ 505 /* if we are already at full speed then break out early */
@@ -522,7 +526,7 @@ static void dbs_check_cpu(struct cpu_dbs_info_s *this_dbs_info)
522 * can support the current CPU usage without triggering the up 526 * can support the current CPU usage without triggering the up
523 * policy. To be safe, we focus 10 points under the threshold. 527 * policy. To be safe, we focus 10 points under the threshold.
524 */ 528 */
525 if (load < (dbs_tuners_ins.down_threshold - 10)) { 529 if (max_load < (dbs_tuners_ins.down_threshold - 10)) {
526 freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100; 530 freq_target = (dbs_tuners_ins.freq_step * policy->max) / 100;
527 531
528 this_dbs_info->requested_freq -= freq_target; 532 this_dbs_info->requested_freq -= freq_target;
diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c
index 5a62d678dd19..00d73fc8e4e2 100644
--- a/drivers/cpufreq/cpufreq_stats.c
+++ b/drivers/cpufreq/cpufreq_stats.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/slab.h>
13#include <linux/sysdev.h> 14#include <linux/sysdev.h>
14#include <linux/cpu.h> 15#include <linux/cpu.h>
15#include <linux/sysfs.h> 16#include <linux/sysfs.h>