cpufreq: Drop 'freq_table' argument of __target_index()
It is already present as part of the policy and so no need to pass it from the caller. Also, 'freq_table' is guaranteed to be valid in this function and so no need to check it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
Родитель
7ab4aabbaa
Коммит
2372784542
|
@ -1852,14 +1852,17 @@ static int __target_intermediate(struct cpufreq_policy *policy,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __target_index(struct cpufreq_policy *policy,
|
static int __target_index(struct cpufreq_policy *policy, int index)
|
||||||
struct cpufreq_frequency_table *freq_table, int index)
|
|
||||||
{
|
{
|
||||||
struct cpufreq_freqs freqs = {.old = policy->cur, .flags = 0};
|
struct cpufreq_freqs freqs = {.old = policy->cur, .flags = 0};
|
||||||
unsigned int intermediate_freq = 0;
|
unsigned int intermediate_freq = 0;
|
||||||
|
unsigned int newfreq = policy->freq_table[index].frequency;
|
||||||
int retval = -EINVAL;
|
int retval = -EINVAL;
|
||||||
bool notify;
|
bool notify;
|
||||||
|
|
||||||
|
if (newfreq == policy->cur)
|
||||||
|
return 0;
|
||||||
|
|
||||||
notify = !(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION);
|
notify = !(cpufreq_driver->flags & CPUFREQ_ASYNC_NOTIFICATION);
|
||||||
if (notify) {
|
if (notify) {
|
||||||
/* Handle switching to intermediate frequency */
|
/* Handle switching to intermediate frequency */
|
||||||
|
@ -1874,7 +1877,7 @@ static int __target_index(struct cpufreq_policy *policy,
|
||||||
freqs.old = freqs.new;
|
freqs.old = freqs.new;
|
||||||
}
|
}
|
||||||
|
|
||||||
freqs.new = freq_table[index].frequency;
|
freqs.new = newfreq;
|
||||||
pr_debug("%s: cpu: %d, oldfreq: %u, new freq: %u\n",
|
pr_debug("%s: cpu: %d, oldfreq: %u, new freq: %u\n",
|
||||||
__func__, policy->cpu, freqs.old, freqs.new);
|
__func__, policy->cpu, freqs.old, freqs.new);
|
||||||
|
|
||||||
|
@ -1911,7 +1914,6 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
|
||||||
unsigned int relation)
|
unsigned int relation)
|
||||||
{
|
{
|
||||||
unsigned int old_target_freq = target_freq;
|
unsigned int old_target_freq = target_freq;
|
||||||
struct cpufreq_frequency_table *freq_table;
|
|
||||||
int index, retval;
|
int index, retval;
|
||||||
|
|
||||||
if (cpufreq_disabled())
|
if (cpufreq_disabled())
|
||||||
|
@ -1941,12 +1943,6 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
|
||||||
if (!cpufreq_driver->target_index)
|
if (!cpufreq_driver->target_index)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
freq_table = policy->freq_table;
|
|
||||||
if (unlikely(!freq_table)) {
|
|
||||||
pr_err("%s: Unable to find freq_table\n", __func__);
|
|
||||||
return -EINVAL;
|
|
||||||
}
|
|
||||||
|
|
||||||
retval = cpufreq_frequency_table_target(policy, target_freq, relation,
|
retval = cpufreq_frequency_table_target(policy, target_freq, relation,
|
||||||
&index);
|
&index);
|
||||||
if (unlikely(retval)) {
|
if (unlikely(retval)) {
|
||||||
|
@ -1954,10 +1950,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (freq_table[index].frequency == policy->cur)
|
return __target_index(policy, index);
|
||||||
return 0;
|
|
||||||
|
|
||||||
return __target_index(policy, freq_table, index);
|
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(__cpufreq_driver_target);
|
EXPORT_SYMBOL_GPL(__cpufreq_driver_target);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче