Skip to content

Commit 9a74bfd

Browse files
committed
cpufreq: Use locking guard and __free() in cpufreq_update_policy()
Instead of using cpufreq_cpu_acquire() and cpufreq_cpu_release() in cpufreq_update_policy(), which is the last user of these functions, make it use __free() for policy reference counting cleanup and the "write" locking guard for policy locking. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <[email protected]> Acked-by: Viresh Kumar <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Acked-by: Sudeep Holla <[email protected]> Tested-by: Sudeep Holla <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 973207a commit 9a74bfd

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/cpufreq/cpufreq.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2780,23 +2780,23 @@ static int cpufreq_set_policy(struct cpufreq_policy *policy,
27802780
*/
27812781
void cpufreq_update_policy(unsigned int cpu)
27822782
{
2783-
struct cpufreq_policy *policy = cpufreq_cpu_acquire(cpu);
2783+
struct cpufreq_policy *policy __free(put_cpufreq_policy);
27842784

2785+
policy = cpufreq_cpu_get(cpu);
27852786
if (!policy)
27862787
return;
27872788

2789+
guard(cpufreq_policy_write)(policy);
2790+
27882791
/*
27892792
* BIOS might change freq behind our back
27902793
* -> ask driver for current freq and notify governors about a change
27912794
*/
27922795
if (cpufreq_driver->get && has_target() &&
27932796
(cpufreq_suspended || WARN_ON(!cpufreq_verify_current_freq(policy, false))))
2794-
goto unlock;
2797+
return;
27952798

27962799
refresh_frequency_limits(policy);
2797-
2798-
unlock:
2799-
cpufreq_cpu_release(policy);
28002800
}
28012801
EXPORT_SYMBOL(cpufreq_update_policy);
28022802

0 commit comments

Comments
 (0)