mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 09:36:22 +02:00
cpufreq: Extract cpufreq_policy_init_qos() function
Extract the QoS-related logic from cpufreq_policy_online() to make that function shorter/simpler. The logic is placed in cpufreq_policy_init_qos() and is now executed right after the following calls: - cpufreq_driver->init() - cpufreq_table_validate_and_sort() This facilitats subsequent changes that will, in cpufreq_policy_init_qos(): - Set a default policy->min/max value for all policies. - Use the policy->min/max values set by drivers as initial request values for policy frequency QoS requests. No functional change. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Zhongqiu Han <zhongqiu.han@oss.qualcomm.com> Reviewed-by: Jie Zhan <zhanjie9@hisilicon.com> [ rjw: Changelog edits ] Link: https://patch.msgid.link/20260528090913.2759118-2-pierre.gondois@arm.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
03120e1425
commit
70fa8a1860
|
|
@ -1397,6 +1397,32 @@ static void cpufreq_policy_free(struct cpufreq_policy *policy)
|
|||
kfree(policy);
|
||||
}
|
||||
|
||||
static int cpufreq_policy_init_qos(struct cpufreq_policy *policy)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if (policy->boost_supported) {
|
||||
ret = freq_qos_add_request(&policy->constraints,
|
||||
&policy->boost_freq_req,
|
||||
FREQ_QOS_MAX,
|
||||
policy->cpuinfo.max_freq);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = freq_qos_add_request(&policy->constraints, &policy->min_freq_req,
|
||||
FREQ_QOS_MIN, FREQ_QOS_MIN_DEFAULT_VALUE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
ret = freq_qos_add_request(&policy->constraints, &policy->max_freq_req,
|
||||
FREQ_QOS_MAX, FREQ_QOS_MAX_DEFAULT_VALUE);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int cpufreq_policy_online(struct cpufreq_policy *policy,
|
||||
unsigned int cpu, bool new_policy)
|
||||
{
|
||||
|
|
@ -1442,6 +1468,12 @@ static int cpufreq_policy_online(struct cpufreq_policy *policy,
|
|||
if (ret)
|
||||
goto out_offline_policy;
|
||||
|
||||
if (new_policy) {
|
||||
ret = cpufreq_policy_init_qos(policy);
|
||||
if (ret < 0)
|
||||
goto out_offline_policy;
|
||||
}
|
||||
|
||||
/* related_cpus should at least include policy->cpus. */
|
||||
cpumask_copy(policy->related_cpus, policy->cpus);
|
||||
}
|
||||
|
|
@ -1458,27 +1490,6 @@ static int cpufreq_policy_online(struct cpufreq_policy *policy,
|
|||
add_cpu_dev_symlink(policy, j, get_cpu_device(j));
|
||||
}
|
||||
|
||||
if (policy->boost_supported) {
|
||||
ret = freq_qos_add_request(&policy->constraints,
|
||||
&policy->boost_freq_req,
|
||||
FREQ_QOS_MAX,
|
||||
policy->cpuinfo.max_freq);
|
||||
if (ret < 0)
|
||||
goto out_destroy_policy;
|
||||
}
|
||||
|
||||
ret = freq_qos_add_request(&policy->constraints,
|
||||
&policy->min_freq_req, FREQ_QOS_MIN,
|
||||
FREQ_QOS_MIN_DEFAULT_VALUE);
|
||||
if (ret < 0)
|
||||
goto out_destroy_policy;
|
||||
|
||||
ret = freq_qos_add_request(&policy->constraints,
|
||||
&policy->max_freq_req, FREQ_QOS_MAX,
|
||||
FREQ_QOS_MAX_DEFAULT_VALUE);
|
||||
if (ret < 0)
|
||||
goto out_destroy_policy;
|
||||
|
||||
blocking_notifier_call_chain(&cpufreq_policy_notifier_list,
|
||||
CPUFREQ_CREATE_POLICY, policy);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user