Skip to contentSkip to conversation

ACPI: processor_idle: Use acpi_idle_play_dead() for all C-states

PATCH In review Rafael J. Wysocki 3 participants 3 messages Nov 14, 2024 – Nov 15, 2024 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: processor_idle: Use acpi_idle_play_dead() for all C-states

From: Rafael J. Wysocki <[email protected]>

Notice that acpi_processor_setup_cstates() can set state->enter_dead to acpi_idle_play_dead() for all C-states unconditionally and remove the confusing C-state type check done before setting it.

No intentional functional impact.

---
 drivers/acpi/processor_idle.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/acpi/processor_idle.c +6 -6
Index: linux-pm/drivers/acpi/processor_idle.c
===================================================================
@@ -803,12 +803,12 @@ static int acpi_processor_setup_cstates(
 		state->enter = acpi_idle_enter;
 
 		state->flags = 0;
-		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 ||
-		    cx->type == ACPI_STATE_C3) {
-			state->enter_dead = acpi_idle_play_dead;
-			if (cx->type != ACPI_STATE_C3)
-				drv->safe_state_index = count;
-		}
+
+		state->enter_dead = acpi_idle_play_dead;
+
+		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2)
+			drv->safe_state_index = count;
+
 		/*
 		 * Halt-induced C1 is not good for ->enter_s2idle, because it
 		 * re-enables interrupts on exit.  Moreover, C1 is generally not
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Notice that acpi_processor_setup_cstates() can set state->enter_dead to acpi_idle_play_dead() for all C-states unconditionally and remove the confusing C-state type check done before setting it.

No intentional functional impact.

Quoted 30 lines
---
  drivers/acpi/processor_idle.c |   12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/acpi/processor_idle.c
===================================================================

drivers/acpi/processor_idle.c +6 -6
@@ -803,12 +803,12 @@ static int acpi_processor_setup_cstates(
  		state->enter = acpi_idle_enter;
 
  		state->flags = 0;
-		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 ||
-		    cx->type == ACPI_STATE_C3) {
-			state->enter_dead = acpi_idle_play_dead;
-			if (cx->type != ACPI_STATE_C3)
-				drv->safe_state_index = count;
-		}
+
+		state->enter_dead = acpi_idle_play_dead;
+
+		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2)
+			drv->safe_state_index = count;
+
  		/*
  		 * Halt-induced C1 is not good for ->enter_s2idle, because it
  		 * re-enables interrupts on exit.  Moreover, C1 is generally not
Acked-by on v1 1/1
#2 lore raw
In reply to Rafael J. Wysocki
Quoted 23 lines · Rafael J. Wysocki

From: Rafael J. Wysocki <[email protected]>

Notice that acpi_processor_setup_cstates() can set state->enter_dead to acpi_idle_play_dead() for all C-states unconditionally and remove the confusing C-state type check done before setting it.

No intentional functional impact.

---
 drivers/acpi/processor_idle.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Index: linux-pm/drivers/acpi/processor_idle.c
===================================================================

drivers/acpi/processor_idle.c +0 -2
@@ -803,12 +803,12 @@ static int acpi_processor_setup_cstates(
 		state->enter = acpi_idle_enter;
 
 		state->flags = 0;
-		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2 ||
-		    cx->type == ACPI_STATE_C3) {

drivers/acpi/processor_idle.c static int acpi_processor_setup_cstates( · line 811

Quoted 10 lines
drivers/acpi/processor_idle.c +6 -4
-			state->enter_dead = acpi_idle_play_dead;
-			if (cx->type != ACPI_STATE_C3)
-				drv->safe_state_index = count;
-		}
+
+		state->enter_dead = acpi_idle_play_dead;
+
+		if (cx->type == ACPI_STATE_C1 || cx->type == ACPI_STATE_C2)
+			drv->safe_state_index = count;
+

Thanks!