cpufreq: cppc: cppc_cpufreq_get_rate() returns zero in all error cases.
The cpufreq framework used to use the zero of return value to reflect the cppc_cpufreq_get_rate() had failed to get current frequecy and treat all positive integer to be succeed. Since cppc_get_perf_ctrs() returns a negative integer in error case, so it is better to convert the value to zero as the return value of cppc_cpufreq_get_rate(). Signed-off-by: Liao Chang <liaochang1@huawei.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
This commit is contained in:
parent
ba6ea77d0e
commit
6a4fec4f6d
@ -849,13 +849,13 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
|
|||||||
|
|
||||||
ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t0);
|
ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t0);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return 0;
|
||||||
|
|
||||||
udelay(2); /* 2usec delay between sampling */
|
udelay(2); /* 2usec delay between sampling */
|
||||||
|
|
||||||
ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t1);
|
ret = cppc_get_perf_ctrs(cpu, &fb_ctrs_t1);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return 0;
|
||||||
|
|
||||||
delivered_perf = cppc_perf_from_fbctrs(cpu_data, &fb_ctrs_t0,
|
delivered_perf = cppc_perf_from_fbctrs(cpu_data, &fb_ctrs_t0,
|
||||||
&fb_ctrs_t1);
|
&fb_ctrs_t1);
|
||||||
|
@ -370,7 +370,7 @@ struct cpufreq_driver {
|
|||||||
int (*target_intermediate)(struct cpufreq_policy *policy,
|
int (*target_intermediate)(struct cpufreq_policy *policy,
|
||||||
unsigned int index);
|
unsigned int index);
|
||||||
|
|
||||||
/* should be defined, if possible */
|
/* should be defined, if possible, return 0 on error */
|
||||||
unsigned int (*get)(unsigned int cpu);
|
unsigned int (*get)(unsigned int cpu);
|
||||||
|
|
||||||
/* Called to update policy limits on firmware notifications. */
|
/* Called to update policy limits on firmware notifications. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user