From f7b2b3a1c0d015c4272793bed89734c5cffb354c Mon Sep 17 00:00:00 2001 From: Dhananjay Ugwekar Date: Thu, 3 Oct 2024 08:39:56 +0000 Subject: cpufreq/amd-pstate: Cleanup the old min_freq qos request remnants Convert the freq_qos_request array in struct amd_cpudata to a single variable (only for max_freq request). Remove the references to cpudata->req array. Remove and rename the jump labels accordingly. Signed-off-by: Dhananjay Ugwekar Reviewed-by: Mario Limonciello --- drivers/cpufreq/amd-pstate.c | 19 ++++++++----------- drivers/cpufreq/amd-pstate.h | 4 ++-- 2 files changed, 10 insertions(+), 13 deletions(-) --- a/drivers/cpufreq/amd-pstate.c +++ b/drivers/cpufreq/amd-pstate.c @@ -726,7 +726,7 @@ static int amd_pstate_cpu_boost_update(s policy->max = policy->cpuinfo.max_freq; if (cppc_state == AMD_PSTATE_PASSIVE) { - ret = freq_qos_update_request(&cpudata->req[1], policy->cpuinfo.max_freq); + ret = freq_qos_update_request(&cpudata->max_freq_req, policy->cpuinfo.max_freq); if (ret < 0) pr_debug("Failed to update freq constraint: CPU%d\n", cpudata->cpu); } @@ -993,17 +993,17 @@ static int amd_pstate_cpu_init(struct cp ret = amd_pstate_init_perf(cpudata); if (ret) - goto free_cpudata1; + goto free_cpudata; amd_pstate_init_prefcore(cpudata); ret = amd_pstate_init_freq(cpudata); if (ret) - goto free_cpudata1; + goto free_cpudata; ret = amd_pstate_init_boost_support(cpudata); if (ret) - goto free_cpudata1; + goto free_cpudata; min_freq = READ_ONCE(cpudata->min_freq); max_freq = READ_ONCE(cpudata->max_freq); @@ -1025,11 +1025,11 @@ static int amd_pstate_cpu_init(struct cp if (cpu_feature_enabled(X86_FEATURE_CPPC)) policy->fast_switch_possible = true; - ret = freq_qos_add_request(&policy->constraints, &cpudata->req[1], + ret = freq_qos_add_request(&policy->constraints, &cpudata->max_freq_req, FREQ_QOS_MAX, policy->cpuinfo.max_freq); if (ret < 0) { dev_err(dev, "Failed to add max-freq constraint (%d)\n", ret); - goto free_cpudata2; + goto free_cpudata; } cpudata->max_limit_freq = max_freq; @@ -1042,9 +1042,7 @@ static int amd_pstate_cpu_init(struct cp return 0; -free_cpudata2: - freq_qos_remove_request(&cpudata->req[0]); -free_cpudata1: +free_cpudata: kfree(cpudata); return ret; } @@ -1053,8 +1051,7 @@ static void amd_pstate_cpu_exit(struct c { struct amd_cpudata *cpudata = policy->driver_data; - freq_qos_remove_request(&cpudata->req[1]); - freq_qos_remove_request(&cpudata->req[0]); + freq_qos_remove_request(&cpudata->max_freq_req); policy->fast_switch_possible = false; kfree(cpudata); } --- a/drivers/cpufreq/amd-pstate.h +++ b/drivers/cpufreq/amd-pstate.h @@ -28,7 +28,7 @@ struct amd_aperf_mperf { /** * struct amd_cpudata - private CPU data for AMD P-State * @cpu: CPU number - * @req: constraint request to apply + * @max_freq_req: maximum frequency constraint request to apply * @cppc_req_cached: cached performance request hints * @highest_perf: the maximum performance an individual processor may reach, * assuming ideal conditions @@ -68,7 +68,7 @@ struct amd_aperf_mperf { struct amd_cpudata { int cpu; - struct freq_qos_request req[2]; + struct freq_qos_request max_freq_req; u64 cppc_req_cached; u32 highest_perf;