mirror of
https://github.com/torvalds/linux.git
synced 2026-01-24 23:16:46 +00:00
cpufreq: Drop redundant freq_table parameter
Since commit e0b3165ba5 ("cpufreq: add 'freq_table' in struct
cpufreq_policy"), freq_table has been stored in struct cpufreq_policy
instead of being maintained separately.
However, several helpers in freq_table.c still take both policy and
freq_table as parameters, even though policy->freq_table can always be
used. This leads to redundant function arguments and increases the
chance of inconsistencies.
This patch removes the unnecessary freq_table argument from these
functions and updates their callers to only pass policy. This makes
the code simpler, more consistent, and avoids duplication.
Signed-off-by: Zihuan Zhang <zhangzihuan@kylinos.cn>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/20250902073323.48330-1-zhangzihuan@kylinos.cn
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
committed by
Rafael J. Wysocki
parent
c69d79c532
commit
97248d05b7
@@ -2793,7 +2793,7 @@ int cpufreq_boost_set_sw(struct cpufreq_policy *policy, int state)
|
||||
if (!policy->freq_table)
|
||||
return -ENXIO;
|
||||
|
||||
ret = cpufreq_frequency_table_cpuinfo(policy, policy->freq_table);
|
||||
ret = cpufreq_frequency_table_cpuinfo(policy);
|
||||
if (ret) {
|
||||
pr_err("%s: Policy frequency update failed\n", __func__);
|
||||
return ret;
|
||||
|
||||
@@ -28,10 +28,9 @@ static bool policy_has_boost_freq(struct cpufreq_policy *policy)
|
||||
return false;
|
||||
}
|
||||
|
||||
int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
|
||||
struct cpufreq_frequency_table *table)
|
||||
int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy)
|
||||
{
|
||||
struct cpufreq_frequency_table *pos;
|
||||
struct cpufreq_frequency_table *pos, *table = policy->freq_table;
|
||||
unsigned int min_freq = ~0;
|
||||
unsigned int max_freq = 0;
|
||||
unsigned int freq;
|
||||
@@ -65,10 +64,9 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
|
||||
return 0;
|
||||
}
|
||||
|
||||
int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy,
|
||||
struct cpufreq_frequency_table *table)
|
||||
int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy)
|
||||
{
|
||||
struct cpufreq_frequency_table *pos;
|
||||
struct cpufreq_frequency_table *pos, *table = policy->freq_table;
|
||||
unsigned int freq, prev_smaller = 0;
|
||||
bool found = false;
|
||||
|
||||
@@ -110,7 +108,7 @@ int cpufreq_generic_frequency_table_verify(struct cpufreq_policy_data *policy)
|
||||
if (!policy->freq_table)
|
||||
return -ENODEV;
|
||||
|
||||
return cpufreq_frequency_table_verify(policy, policy->freq_table);
|
||||
return cpufreq_frequency_table_verify(policy);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(cpufreq_generic_frequency_table_verify);
|
||||
|
||||
@@ -354,7 +352,7 @@ int cpufreq_table_validate_and_sort(struct cpufreq_policy *policy)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = cpufreq_frequency_table_cpuinfo(policy, policy->freq_table);
|
||||
ret = cpufreq_frequency_table_cpuinfo(policy);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -89,11 +89,9 @@ static int sh_cpufreq_target(struct cpufreq_policy *policy,
|
||||
static int sh_cpufreq_verify(struct cpufreq_policy_data *policy)
|
||||
{
|
||||
struct clk *cpuclk = &per_cpu(sh_cpuclk, policy->cpu);
|
||||
struct cpufreq_frequency_table *freq_table;
|
||||
|
||||
freq_table = cpuclk->nr_freqs ? cpuclk->freq_table : NULL;
|
||||
if (freq_table)
|
||||
return cpufreq_frequency_table_verify(policy, freq_table);
|
||||
if (policy->freq_table)
|
||||
return cpufreq_frequency_table_verify(policy);
|
||||
|
||||
cpufreq_verify_within_cpu_limits(policy);
|
||||
|
||||
|
||||
@@ -250,7 +250,7 @@ static int virt_cpufreq_offline(struct cpufreq_policy *policy)
|
||||
static int virt_cpufreq_verify_policy(struct cpufreq_policy_data *policy)
|
||||
{
|
||||
if (policy->freq_table)
|
||||
return cpufreq_frequency_table_verify(policy, policy->freq_table);
|
||||
return cpufreq_frequency_table_verify(policy);
|
||||
|
||||
cpufreq_verify_within_cpu_limits(policy);
|
||||
return 0;
|
||||
|
||||
@@ -780,11 +780,10 @@ struct cpufreq_frequency_table {
|
||||
else
|
||||
|
||||
|
||||
int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy,
|
||||
struct cpufreq_frequency_table *table);
|
||||
int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy);
|
||||
|
||||
int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy);
|
||||
|
||||
int cpufreq_frequency_table_verify(struct cpufreq_policy_data *policy,
|
||||
struct cpufreq_frequency_table *table);
|
||||
int cpufreq_generic_frequency_table_verify(struct cpufreq_policy_data *policy);
|
||||
|
||||
int cpufreq_table_index_unsorted(struct cpufreq_policy *policy,
|
||||
|
||||
Reference in New Issue
Block a user