@@ -524,19 +524,8 @@ void cpufreq_disable_fast_switch(struct cpufreq_policy *policy)
524
524
}
525
525
EXPORT_SYMBOL_GPL (cpufreq_disable_fast_switch );
526
526
527
- /**
528
- * cpufreq_driver_resolve_freq - Map a target frequency to a driver-supported
529
- * one.
530
- * @policy: associated policy to interrogate
531
- * @target_freq: target frequency to resolve.
532
- *
533
- * The target to driver frequency mapping is cached in the policy.
534
- *
535
- * Return: Lowest driver-supported frequency greater than or equal to the
536
- * given target_freq, subject to policy (min/max) and driver limitations.
537
- */
538
- unsigned int cpufreq_driver_resolve_freq (struct cpufreq_policy * policy ,
539
- unsigned int target_freq )
527
+ static unsigned int __resolve_freq (struct cpufreq_policy * policy ,
528
+ unsigned int target_freq , unsigned int relation )
540
529
{
541
530
target_freq = clamp_val (target_freq , policy -> min , policy -> max );
542
531
policy -> cached_target_freq = target_freq ;
@@ -545,7 +534,7 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
545
534
unsigned int idx ;
546
535
547
536
idx = cpufreq_frequency_table_target (policy , target_freq ,
548
- CPUFREQ_RELATION_L );
537
+ relation );
549
538
policy -> cached_resolved_idx = idx ;
550
539
return policy -> freq_table [idx ].frequency ;
551
540
}
@@ -555,6 +544,23 @@ unsigned int cpufreq_driver_resolve_freq(struct cpufreq_policy *policy,
555
544
556
545
return target_freq ;
557
546
}
547
+
548
+ /**
549
+ * cpufreq_driver_resolve_freq - Map a target frequency to a driver-supported
550
+ * one.
551
+ * @policy: associated policy to interrogate
552
+ * @target_freq: target frequency to resolve.
553
+ *
554
+ * The target to driver frequency mapping is cached in the policy.
555
+ *
556
+ * Return: Lowest driver-supported frequency greater than or equal to the
557
+ * given target_freq, subject to policy (min/max) and driver limitations.
558
+ */
559
+ unsigned int cpufreq_driver_resolve_freq (struct cpufreq_policy * policy ,
560
+ unsigned int target_freq )
561
+ {
562
+ return __resolve_freq (policy , target_freq , CPUFREQ_RELATION_L );
563
+ }
558
564
EXPORT_SYMBOL_GPL (cpufreq_driver_resolve_freq );
559
565
560
566
unsigned int cpufreq_policy_transition_delay_us (struct cpufreq_policy * policy )
@@ -2231,13 +2237,11 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
2231
2237
unsigned int relation )
2232
2238
{
2233
2239
unsigned int old_target_freq = target_freq ;
2234
- int index ;
2235
2240
2236
2241
if (cpufreq_disabled ())
2237
2242
return - ENODEV ;
2238
2243
2239
- /* Make sure that target_freq is within supported range */
2240
- target_freq = clamp_val (target_freq , policy -> min , policy -> max );
2244
+ target_freq = __resolve_freq (policy , target_freq , relation );
2241
2245
2242
2246
pr_debug ("target for CPU %u: %u kHz, relation %u, requested %u kHz\n" ,
2243
2247
policy -> cpu , target_freq , relation , old_target_freq );
@@ -2258,9 +2262,7 @@ int __cpufreq_driver_target(struct cpufreq_policy *policy,
2258
2262
if (!cpufreq_driver -> target_index )
2259
2263
return - EINVAL ;
2260
2264
2261
- index = cpufreq_frequency_table_target (policy , target_freq , relation );
2262
-
2263
- return __target_index (policy , index );
2265
+ return __target_index (policy , policy -> cached_resolved_idx );
2264
2266
}
2265
2267
EXPORT_SYMBOL_GPL (__cpufreq_driver_target );
2266
2268
0 commit comments