Skip to content

Commit 945661d

Browse files
LiHuiSong1rafaeljw
authored andcommitted
ACPI: processor: idle: Relocate state flags initialization
Since acpi_processor_setup_cstates() is a more logical place for setting idle state flags than acpi_processor_setup_cpuidle_cx(), move that code from the latter to the former. It also allows direct references to acpi_idle_driver in acpi_processor_setup_cpuidle_cx() to be avoided. No intentional functional impact. Signed-off-by: Huisong Li <lihuisong@huawei.com> [ rjw: Subject and changelog rewrite ] Link: https://patch.msgid.link/20250929093754.3998136-5-lihuisong@huawei.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 211ddde commit 945661d

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

drivers/acpi/processor_idle.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -737,29 +737,18 @@ static int acpi_processor_setup_cpuidle_cx(struct acpi_processor *pr,
737737
{
738738
int i, count = ACPI_IDLE_STATE_START;
739739
struct acpi_processor_cx *cx;
740-
struct cpuidle_state *state;
741740

742741
if (max_cstate == 0)
743742
max_cstate = 1;
744743

745744
for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) {
746-
state = &acpi_idle_driver.states[count];
747745
cx = &pr->power.states[i];
748746

749747
if (!cx->valid)
750748
continue;
751749

752750
per_cpu(acpi_cstate[count], dev->cpu) = cx;
753751

754-
if (lapic_timer_needs_broadcast(pr, cx))
755-
state->flags |= CPUIDLE_FLAG_TIMER_STOP;
756-
757-
if (cx->type == ACPI_STATE_C3) {
758-
state->flags |= CPUIDLE_FLAG_TLB_FLUSHED;
759-
if (pr->flags.bm_check)
760-
state->flags |= CPUIDLE_FLAG_RCU_IDLE;
761-
}
762-
763752
count++;
764753
if (count == CPUIDLE_STATE_MAX)
765754
break;
@@ -818,6 +807,15 @@ static int acpi_processor_setup_cstates(struct acpi_processor *pr)
818807
if (cx->type != ACPI_STATE_C1 && !acpi_idle_fallback_to_c1(pr))
819808
state->enter_s2idle = acpi_idle_enter_s2idle;
820809

810+
if (lapic_timer_needs_broadcast(pr, cx))
811+
state->flags |= CPUIDLE_FLAG_TIMER_STOP;
812+
813+
if (cx->type == ACPI_STATE_C3) {
814+
state->flags |= CPUIDLE_FLAG_TLB_FLUSHED;
815+
if (pr->flags.bm_check)
816+
state->flags |= CPUIDLE_FLAG_RCU_IDLE;
817+
}
818+
821819
count++;
822820
if (count == CPUIDLE_STATE_MAX)
823821
break;

0 commit comments

Comments
 (0)