Skip to content

Commit 86d71f1

Browse files
kudureranganathsuperm1
authored andcommitted
cpufreq/amd-pstate: Pass the policy to amd_pstate_update()
All callers of amd_pstate_update() already have a reference to the cpufreq_policy object. Pass the entire policy object and grab the cpudata using "policy->driver_data" instead of passing the cpudata and unnecessarily grabbing another read-side reference to the cpufreq policy object when it is already available in the caller. No functional changes intended. Reviewed-by: Mario Limonciello (AMD) <superm1@kernel.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com> Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com> Link: https://lore.kernel.org/r/20260316081849.19368-2-kprateek.nayak@amd.com Signed-off-by: Mario Limonciello (AMD) <superm1@kernel.org>
1 parent 7e173bc commit 86d71f1

1 file changed

Lines changed: 4 additions & 7 deletions

File tree

drivers/cpufreq/amd-pstate.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -643,15 +643,12 @@ static inline bool amd_pstate_sample(struct amd_cpudata *cpudata)
643643
return true;
644644
}
645645

646-
static void amd_pstate_update(struct amd_cpudata *cpudata, u8 min_perf,
646+
static void amd_pstate_update(struct cpufreq_policy *policy, u8 min_perf,
647647
u8 des_perf, u8 max_perf, bool fast_switch, int gov_flags)
648648
{
649-
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpudata->cpu);
649+
struct amd_cpudata *cpudata = policy->driver_data;
650650
union perf_cached perf = READ_ONCE(cpudata->perf);
651651

652-
if (!policy)
653-
return;
654-
655652
/* limit the max perf when core performance boost feature is disabled */
656653
if (!cpudata->boost_supported)
657654
max_perf = min_t(u8, perf.nominal_perf, max_perf);
@@ -766,7 +763,7 @@ static int amd_pstate_update_freq(struct cpufreq_policy *policy,
766763
if (!fast_switch)
767764
cpufreq_freq_transition_begin(policy, &freqs);
768765

769-
amd_pstate_update(cpudata, perf.min_limit_perf, des_perf,
766+
amd_pstate_update(policy, perf.min_limit_perf, des_perf,
770767
perf.max_limit_perf, fast_switch,
771768
policy->governor->flags);
772769

@@ -828,7 +825,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
828825
if (max_perf < min_perf)
829826
max_perf = min_perf;
830827

831-
amd_pstate_update(cpudata, min_perf, des_perf, max_perf, true,
828+
amd_pstate_update(policy, min_perf, des_perf, max_perf, true,
832829
policy->governor->flags);
833830
}
834831

0 commit comments

Comments
 (0)