@@ -819,19 +819,13 @@ static void acpi_processor_setup_cstates(struct acpi_processor *pr)
819819 drv -> state_count = count ;
820820}
821821
822- static inline void acpi_processor_cstate_first_run_checks (void )
822+ static inline void acpi_processor_update_max_cstate (void )
823823{
824- static int first_run ;
825-
826- if (first_run )
827- return ;
828824 dmi_check_system (processor_power_dmi_table );
829825 max_cstate = acpi_processor_cstate_check (max_cstate );
830826 if (max_cstate < ACPI_C_STATES_MAX )
831827 pr_notice ("processor limited to max C-state %d\n" , max_cstate );
832828
833- first_run ++ ;
834-
835829 if (nocst )
836830 return ;
837831
@@ -840,7 +834,7 @@ static inline void acpi_processor_cstate_first_run_checks(void)
840834#else
841835
842836static inline int disabled_by_idle_boot_param (void ) { return 0 ; }
843- static inline void acpi_processor_cstate_first_run_checks (void ) { }
837+ static inline void acpi_processor_update_max_cstate (void ) { }
844838static int acpi_processor_get_cstate_info (struct acpi_processor * pr )
845839{
846840 return - ENODEV ;
@@ -1016,9 +1010,7 @@ static bool combine_lpi_states(struct acpi_lpi_state *local,
10161010 result -> arch_flags = parent -> arch_flags ;
10171011 result -> index = parent -> index ;
10181012
1019- strscpy (result -> desc , local -> desc , ACPI_CX_DESC_LEN );
1020- strlcat (result -> desc , "+" , ACPI_CX_DESC_LEN );
1021- strlcat (result -> desc , parent -> desc , ACPI_CX_DESC_LEN );
1013+ scnprintf (result -> desc , ACPI_CX_DESC_LEN , "%s+%s" , local -> desc , parent -> desc );
10221014 return true;
10231015}
10241016
@@ -1068,6 +1060,8 @@ static unsigned int flatten_lpi_states(struct acpi_processor *pr,
10681060 stash_composite_state (curr_level , flpi );
10691061 flat_state_cnt ++ ;
10701062 flpi ++ ;
1063+ if (flat_state_cnt >= ACPI_PROCESSOR_MAX_POWER )
1064+ break ;
10711065 }
10721066 }
10731067 }
@@ -1357,6 +1351,8 @@ void acpi_processor_register_idle_driver(void)
13571351 int ret = - ENODEV ;
13581352 int cpu ;
13591353
1354+ acpi_processor_update_max_cstate ();
1355+
13601356 /*
13611357 * ACPI idle driver is used by all possible CPUs.
13621358 * Use the processor power info of one in them to set up idle states.
@@ -1368,7 +1364,6 @@ void acpi_processor_register_idle_driver(void)
13681364 if (!pr )
13691365 continue ;
13701366
1371- acpi_processor_cstate_first_run_checks ();
13721367 ret = acpi_processor_get_power_info (pr );
13731368 if (!ret ) {
13741369 pr -> flags .power_setup_done = 1 ;
@@ -1409,8 +1404,6 @@ void acpi_processor_power_init(struct acpi_processor *pr)
14091404 if (disabled_by_idle_boot_param ())
14101405 return ;
14111406
1412- acpi_processor_cstate_first_run_checks ();
1413-
14141407 if (!acpi_processor_get_power_info (pr ))
14151408 pr -> flags .power_setup_done = 1 ;
14161409
0 commit comments