2626
2727#include <acpi/cppc_acpi.h>
2828
29- /*
30- * This list contains information parsed from per CPU ACPI _CPC and _PSD
31- * structures: e.g. the highest and lowest supported performance, capabilities,
32- * desired performance, level requested etc. Depending on the share_type, not
33- * all CPUs will have an entry in the list.
34- */
35- static LIST_HEAD (cpu_data_list );
36-
3729static struct cpufreq_driver cppc_cpufreq_driver ;
3830
3931#ifdef CONFIG_ACPI_CPPC_CPUFREQ_FIE
@@ -352,7 +344,6 @@ static unsigned int cppc_cpufreq_get_transition_delay_us(unsigned int cpu)
352344#if defined(CONFIG_ARM64 ) && defined(CONFIG_ENERGY_MODEL )
353345
354346static DEFINE_PER_CPU (unsigned int , efficiency_class ) ;
355- static void cppc_cpufreq_register_em (struct cpufreq_policy * policy );
356347
357348/* Create an artificial performance state every CPPC_EM_CAP_STEP capacity unit. */
358349#define CPPC_EM_CAP_STEP (20)
@@ -488,7 +479,19 @@ static int cppc_get_cpu_cost(struct device *cpu_dev, unsigned long KHz,
488479 return 0 ;
489480}
490481
491- static int populate_efficiency_class (void )
482+ static void cppc_cpufreq_register_em (struct cpufreq_policy * policy )
483+ {
484+ struct cppc_cpudata * cpu_data ;
485+ struct em_data_callback em_cb =
486+ EM_ADV_DATA_CB (cppc_get_cpu_power , cppc_get_cpu_cost );
487+
488+ cpu_data = policy -> driver_data ;
489+ em_dev_register_perf_domain (get_cpu_device (policy -> cpu ),
490+ get_perf_level_count (policy ), & em_cb ,
491+ cpu_data -> shared_cpu_map , 0 );
492+ }
493+
494+ static void populate_efficiency_class (void )
492495{
493496 struct acpi_madt_generic_interrupt * gicc ;
494497 DECLARE_BITMAP (used_classes , 256 ) = {};
@@ -503,7 +506,7 @@ static int populate_efficiency_class(void)
503506 if (bitmap_weight (used_classes , 256 ) <= 1 ) {
504507 pr_debug ("Efficiency classes are all equal (=%d). "
505508 "No EM registered" , class );
506- return - EINVAL ;
509+ return ;
507510 }
508511
509512 /*
@@ -520,26 +523,11 @@ static int populate_efficiency_class(void)
520523 index ++ ;
521524 }
522525 cppc_cpufreq_driver .register_em = cppc_cpufreq_register_em ;
523-
524- return 0 ;
525- }
526-
527- static void cppc_cpufreq_register_em (struct cpufreq_policy * policy )
528- {
529- struct cppc_cpudata * cpu_data ;
530- struct em_data_callback em_cb =
531- EM_ADV_DATA_CB (cppc_get_cpu_power , cppc_get_cpu_cost );
532-
533- cpu_data = policy -> driver_data ;
534- em_dev_register_perf_domain (get_cpu_device (policy -> cpu ),
535- get_perf_level_count (policy ), & em_cb ,
536- cpu_data -> shared_cpu_map , 0 );
537526}
538527
539528#else
540- static int populate_efficiency_class (void )
529+ static void populate_efficiency_class (void )
541530{
542- return 0 ;
543531}
544532#endif
545533
@@ -567,8 +555,6 @@ static struct cppc_cpudata *cppc_cpufreq_get_cpu_data(unsigned int cpu)
567555 goto free_mask ;
568556 }
569557
570- list_add (& cpu_data -> node , & cpu_data_list );
571-
572558 return cpu_data ;
573559
574560free_mask :
@@ -583,7 +569,6 @@ static void cppc_cpufreq_put_cpu_data(struct cpufreq_policy *policy)
583569{
584570 struct cppc_cpudata * cpu_data = policy -> driver_data ;
585571
586- list_del (& cpu_data -> node );
587572 free_cpumask_var (cpu_data -> shared_cpu_map );
588573 kfree (cpu_data );
589574 policy -> driver_data = NULL ;
@@ -954,24 +939,10 @@ static int __init cppc_cpufreq_init(void)
954939 return ret ;
955940}
956941
957- static inline void free_cpu_data (void )
958- {
959- struct cppc_cpudata * iter , * tmp ;
960-
961- list_for_each_entry_safe (iter , tmp , & cpu_data_list , node ) {
962- free_cpumask_var (iter -> shared_cpu_map );
963- list_del (& iter -> node );
964- kfree (iter );
965- }
966-
967- }
968-
969942static void __exit cppc_cpufreq_exit (void )
970943{
971944 cpufreq_unregister_driver (& cppc_cpufreq_driver );
972945 cppc_freq_invariance_exit ();
973-
974- free_cpu_data ();
975946}
976947
977948module_exit (cppc_cpufreq_exit );
0 commit comments