aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2013-04-01 08:57:44 -0400
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2013-04-02 09:10:48 -0400
commitfd143b4d6fb763183ef6e46d1ab84a42c59079af (patch)
tree2a0a45844d1ef74740b344b2ed5158a1d6fd4841
parent746b3df98b2edc0e0844537a247e820ac6503031 (diff)
cpufreq: cpufreq-cpu0: Call CPUFREQ_POSTCHANGE notifier for failure cases too
Currently we are simply returning from target() if we encounter some error after broadcasting CPUFREQ_PRECHANGE notifier. Which looks to be wrong as others might depend on POSTCHANGE notifier for their functioning. So, better broadcast CPUFREQ_POSTCHANGE notifier for these failure cases too, but with old frequency. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r--drivers/cpufreq/cpufreq-cpu0.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c
index 4c5a4cfab3e5..a7e51bd20502 100644
--- a/drivers/cpufreq/cpufreq-cpu0.c
+++ b/drivers/cpufreq/cpufreq-cpu0.c
@@ -77,7 +77,9 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
77 if (IS_ERR(opp)) { 77 if (IS_ERR(opp)) {
78 rcu_read_unlock(); 78 rcu_read_unlock();
79 pr_err("failed to find OPP for %ld\n", freq_Hz); 79 pr_err("failed to find OPP for %ld\n", freq_Hz);
80 return PTR_ERR(opp); 80 freqs.new = freqs.old;
81 ret = PTR_ERR(opp);
82 goto post_notify;
81 } 83 }
82 volt = opp_get_voltage(opp); 84 volt = opp_get_voltage(opp);
83 rcu_read_unlock(); 85 rcu_read_unlock();
@@ -95,7 +97,7 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
95 if (ret) { 97 if (ret) {
96 pr_err("failed to scale voltage up: %d\n", ret); 98 pr_err("failed to scale voltage up: %d\n", ret);
97 freqs.new = freqs.old; 99 freqs.new = freqs.old;
98 return ret; 100 goto post_notify;
99 } 101 }
100 } 102 }
101 103
@@ -104,7 +106,8 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
104 pr_err("failed to set clock rate: %d\n", ret); 106 pr_err("failed to set clock rate: %d\n", ret);
105 if (cpu_reg) 107 if (cpu_reg)
106 regulator_set_voltage_tol(cpu_reg, volt_old, tol); 108 regulator_set_voltage_tol(cpu_reg, volt_old, tol);
107 return ret; 109 freqs.new = freqs.old;
110 goto post_notify;
108 } 111 }
109 112
110 /* scaling down? scale voltage after frequency */ 113 /* scaling down? scale voltage after frequency */
@@ -114,16 +117,16 @@ static int cpu0_set_target(struct cpufreq_policy *policy,
114 pr_err("failed to scale voltage down: %d\n", ret); 117 pr_err("failed to scale voltage down: %d\n", ret);
115 clk_set_rate(cpu_clk, freqs.old * 1000); 118 clk_set_rate(cpu_clk, freqs.old * 1000);
116 freqs.new = freqs.old; 119 freqs.new = freqs.old;
117 return ret;
118 } 120 }
119 } 121 }
120 122
123post_notify:
121 for_each_online_cpu(cpu) { 124 for_each_online_cpu(cpu) {
122 freqs.cpu = cpu; 125 freqs.cpu = cpu;
123 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 126 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
124 } 127 }
125 128
126 return 0; 129 return ret;
127} 130}
128 131
129static int cpu0_cpufreq_init(struct cpufreq_policy *policy) 132static int cpu0_cpufreq_init(struct cpufreq_policy *policy)