aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-01-12 00:14:39 -0500
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-02-01 18:01:14 -0500
commitf6a7409cab3b525c5e55540e7cd08d23e198352f (patch)
tree90b912c47fee9f524731436a88b5f0bf0e4b3fa0 /drivers/cpufreq
parent643ae6e81dd65b333a13259852405fc9f764ac76 (diff)
cpufreq: Notify governors when cpus are hot-[un]plugged
Because cpufreq core and governors worry only about the online cpus, if a cpu is hot [un]plugged, we must notify governors about it, otherwise be ready to expect something unexpected. We already have notifiers in the form of CPUFREQ_GOV_START/CPUFREQ_GOV_STOP, we just need to call them now. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cpufreq.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index de9951766dd8..a0a33bdb4533 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -751,11 +751,16 @@ static int cpufreq_add_dev_policy(unsigned int cpu,
751 return -EBUSY; 751 return -EBUSY;
752 } 752 }
753 753
754 __cpufreq_governor(managed_policy, CPUFREQ_GOV_STOP);
755
754 spin_lock_irqsave(&cpufreq_driver_lock, flags); 756 spin_lock_irqsave(&cpufreq_driver_lock, flags);
755 cpumask_copy(managed_policy->cpus, policy->cpus); 757 cpumask_copy(managed_policy->cpus, policy->cpus);
756 per_cpu(cpufreq_cpu_data, cpu) = managed_policy; 758 per_cpu(cpufreq_cpu_data, cpu) = managed_policy;
757 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 759 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
758 760
761 __cpufreq_governor(managed_policy, CPUFREQ_GOV_START);
762 __cpufreq_governor(managed_policy, CPUFREQ_GOV_LIMITS);
763
759 pr_debug("CPU already managed, adding link\n"); 764 pr_debug("CPU already managed, adding link\n");
760 ret = sysfs_create_link(&dev->kobj, 765 ret = sysfs_create_link(&dev->kobj,
761 &managed_policy->kobj, 766 &managed_policy->kobj,
@@ -1066,8 +1071,13 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif
1066 */ 1071 */
1067 if (unlikely(cpu != data->cpu)) { 1072 if (unlikely(cpu != data->cpu)) {
1068 pr_debug("removing link\n"); 1073 pr_debug("removing link\n");
1074 __cpufreq_governor(data, CPUFREQ_GOV_STOP);
1069 cpumask_clear_cpu(cpu, data->cpus); 1075 cpumask_clear_cpu(cpu, data->cpus);
1070 spin_unlock_irqrestore(&cpufreq_driver_lock, flags); 1076 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1077
1078 __cpufreq_governor(data, CPUFREQ_GOV_START);
1079 __cpufreq_governor(data, CPUFREQ_GOV_LIMITS);
1080
1071 kobj = &dev->kobj; 1081 kobj = &dev->kobj;
1072 cpufreq_cpu_put(data); 1082 cpufreq_cpu_put(data);
1073 unlock_policy_rwsem_write(cpu); 1083 unlock_policy_rwsem_write(cpu);