aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq/cpufreq.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/cpufreq/cpufreq.c')
-rw-r--r--drivers/cpufreq/cpufreq.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 1b8a48eaf90f..2d53f47d1747 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1075,14 +1075,14 @@ static int __cpufreq_remove_dev(struct device *dev, struct subsys_interface *sif
1075 __func__, cpu_dev->id, cpu); 1075 __func__, cpu_dev->id, cpu);
1076 } 1076 }
1077 1077
1078 if ((cpus == 1) && (cpufreq_driver->target))
1079 __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);
1080
1078 pr_debug("%s: removing link, cpu: %d\n", __func__, cpu); 1081 pr_debug("%s: removing link, cpu: %d\n", __func__, cpu);
1079 cpufreq_cpu_put(data); 1082 cpufreq_cpu_put(data);
1080 1083
1081 /* If cpu is last user of policy, free policy */ 1084 /* If cpu is last user of policy, free policy */
1082 if (cpus == 1) { 1085 if (cpus == 1) {
1083 if (cpufreq_driver->target)
1084 __cpufreq_governor(data, CPUFREQ_GOV_POLICY_EXIT);
1085
1086 lock_policy_rwsem_read(cpu); 1086 lock_policy_rwsem_read(cpu);
1087 kobj = &data->kobj; 1087 kobj = &data->kobj;
1088 cmp = &data->kobj_unregister; 1088 cmp = &data->kobj_unregister;
@@ -1729,18 +1729,23 @@ static int __cpufreq_set_policy(struct cpufreq_policy *data,
1729 /* end old governor */ 1729 /* end old governor */
1730 if (data->governor) { 1730 if (data->governor) {
1731 __cpufreq_governor(data, CPUFREQ_GOV_STOP); 1731 __cpufreq_governor(data, CPUFREQ_GOV_STOP);
1732 unlock_policy_rwsem_write(policy->cpu);
1732 __cpufreq_governor(data, 1733 __cpufreq_governor(data,
1733 CPUFREQ_GOV_POLICY_EXIT); 1734 CPUFREQ_GOV_POLICY_EXIT);
1735 lock_policy_rwsem_write(policy->cpu);
1734 } 1736 }
1735 1737
1736 /* start new governor */ 1738 /* start new governor */
1737 data->governor = policy->governor; 1739 data->governor = policy->governor;
1738 if (!__cpufreq_governor(data, CPUFREQ_GOV_POLICY_INIT)) { 1740 if (!__cpufreq_governor(data, CPUFREQ_GOV_POLICY_INIT)) {
1739 if (!__cpufreq_governor(data, CPUFREQ_GOV_START)) 1741 if (!__cpufreq_governor(data, CPUFREQ_GOV_START)) {
1740 failed = 0; 1742 failed = 0;
1741 else 1743 } else {
1744 unlock_policy_rwsem_write(policy->cpu);
1742 __cpufreq_governor(data, 1745 __cpufreq_governor(data,
1743 CPUFREQ_GOV_POLICY_EXIT); 1746 CPUFREQ_GOV_POLICY_EXIT);
1747 lock_policy_rwsem_write(policy->cpu);
1748 }
1744 } 1749 }
1745 1750
1746 if (failed) { 1751 if (failed) {
@@ -1832,15 +1837,13 @@ static int __cpuinit cpufreq_cpu_callback(struct notifier_block *nfb,
1832 if (dev) { 1837 if (dev) {
1833 switch (action) { 1838 switch (action) {
1834 case CPU_ONLINE: 1839 case CPU_ONLINE:
1835 case CPU_ONLINE_FROZEN:
1836 cpufreq_add_dev(dev, NULL); 1840 cpufreq_add_dev(dev, NULL);
1837 break; 1841 break;
1838 case CPU_DOWN_PREPARE: 1842 case CPU_DOWN_PREPARE:
1839 case CPU_DOWN_PREPARE_FROZEN: 1843 case CPU_UP_CANCELED_FROZEN:
1840 __cpufreq_remove_dev(dev, NULL); 1844 __cpufreq_remove_dev(dev, NULL);
1841 break; 1845 break;
1842 case CPU_DOWN_FAILED: 1846 case CPU_DOWN_FAILED:
1843 case CPU_DOWN_FAILED_FROZEN:
1844 cpufreq_add_dev(dev, NULL); 1847 cpufreq_add_dev(dev, NULL);
1845 break; 1848 break;
1846 } 1849 }