@@ -548,7 +548,7 @@ static inline bool amd_pstate_sample(struct amd_cpudata *cpudata)
548
548
static void amd_pstate_update (struct amd_cpudata * cpudata , u8 min_perf ,
549
549
u8 des_perf , u8 max_perf , bool fast_switch , int gov_flags )
550
550
{
551
- struct cpufreq_policy * policy = cpufreq_cpu_get (cpudata -> cpu );
551
+ struct cpufreq_policy * policy __free ( put_cpufreq_policy ) = cpufreq_cpu_get (cpudata -> cpu );
552
552
u8 nominal_perf = READ_ONCE (cpudata -> nominal_perf );
553
553
554
554
if (!policy )
@@ -574,8 +574,6 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u8 min_perf,
574
574
}
575
575
576
576
amd_pstate_update_perf (cpudata , min_perf , des_perf , max_perf , 0 , fast_switch );
577
-
578
- cpufreq_cpu_put (policy );
579
577
}
580
578
581
579
static int amd_pstate_verify (struct cpufreq_policy_data * policy_data )
@@ -587,15 +585,15 @@ static int amd_pstate_verify(struct cpufreq_policy_data *policy_data)
587
585
* amd-pstate qos_requests.
588
586
*/
589
587
if (policy_data -> min == FREQ_QOS_MIN_DEFAULT_VALUE ) {
590
- struct cpufreq_policy * policy = cpufreq_cpu_get (policy_data -> cpu );
588
+ struct cpufreq_policy * policy __free (put_cpufreq_policy ) =
589
+ cpufreq_cpu_get (policy_data -> cpu );
591
590
struct amd_cpudata * cpudata ;
592
591
593
592
if (!policy )
594
593
return - EINVAL ;
595
594
596
595
cpudata = policy -> driver_data ;
597
596
policy_data -> min = cpudata -> lowest_nonlinear_freq ;
598
- cpufreq_cpu_put (policy );
599
597
}
600
598
601
599
cpufreq_verify_within_cpu_limits (policy_data );
@@ -678,7 +676,7 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
678
676
unsigned long capacity )
679
677
{
680
678
u8 max_perf , min_perf , des_perf , cap_perf , min_limit_perf ;
681
- struct cpufreq_policy * policy = cpufreq_cpu_get (cpu );
679
+ struct cpufreq_policy * policy __free ( put_cpufreq_policy ) = cpufreq_cpu_get (cpu );
682
680
struct amd_cpudata * cpudata ;
683
681
684
682
if (!policy )
@@ -710,7 +708,6 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
710
708
711
709
amd_pstate_update (cpudata , min_perf , des_perf , max_perf , true,
712
710
policy -> governor -> flags );
713
- cpufreq_cpu_put (policy );
714
711
}
715
712
716
713
static int amd_pstate_cpu_boost_update (struct cpufreq_policy * policy , bool on )
@@ -824,28 +821,23 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
824
821
825
822
static void amd_pstate_update_limits (unsigned int cpu )
826
823
{
827
- struct cpufreq_policy * policy = NULL ;
824
+ struct cpufreq_policy * policy __free ( put_cpufreq_policy ) = cpufreq_cpu_get ( cpu ) ;
828
825
struct amd_cpudata * cpudata ;
829
826
u32 prev_high = 0 , cur_high = 0 ;
830
- int ret ;
831
827
bool highest_perf_changed = false;
832
828
833
829
if (!amd_pstate_prefcore )
834
830
return ;
835
831
836
- policy = cpufreq_cpu_get (cpu );
837
832
if (!policy )
838
833
return ;
839
834
840
- cpudata = policy -> driver_data ;
841
-
842
835
guard (mutex )(& amd_pstate_driver_lock );
843
836
844
- ret = amd_get_highest_perf (cpu , & cur_high );
845
- if (ret ) {
846
- cpufreq_cpu_put (policy );
837
+ if (amd_get_highest_perf (cpu , & cur_high ))
847
838
return ;
848
- }
839
+
840
+ cpudata = policy -> driver_data ;
849
841
850
842
prev_high = READ_ONCE (cpudata -> prefcore_ranking );
851
843
highest_perf_changed = (prev_high != cur_high );
@@ -855,7 +847,6 @@ static void amd_pstate_update_limits(unsigned int cpu)
855
847
if (cur_high < CPPC_MAX_PERF )
856
848
sched_set_itmt_core_prio ((int )cur_high , cpu );
857
849
}
858
- cpufreq_cpu_put (policy );
859
850
}
860
851
861
852
/*
0 commit comments