Skip to contentSkip to conversation

ACPI: PM: s2idle: Add missing checks to acpi_s2idle_begin_lps0()

PATCH In review Rafael J. Wysocki 2 participants 2 messages Jan 7 – Jan 8 ACPI

lore
Share & tools
lore

Rafael J. Wysocki

author maintainer
#0 lore raw

PATCH 1/1 ACPI: PM: s2idle: Add missing checks to acpi_s2idle_begin_lps0()

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

Commit 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed"), that attempted to avoid useless evaluation of LPS0 _DSM Function 1 in lps0_device_attach(), forgot to add checks for lps0_device_handle and sleep_no_lps0 to acpi_s2idle_begin_lps0() where they should be done before calling lpi_device_get_constraints() or lpi_device_get_constraints_amd().

Add the missing checks.

Fixes 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed")
---
 drivers/acpi/x86/s2idle.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/x86/s2idle.c +2 -1
@@ -515,7 +515,8 @@ static struct acpi_scan_handler lps0_han
 
 static int acpi_s2idle_begin_lps0(void)
 {
-	if (pm_debug_messages_on && !lpi_constraints_table) {
+	if (lps0_device_handle && !sleep_no_lps0 && pm_debug_messages_on &&
+	    !lpi_constraints_table) {
 		if (acpi_s2idle_vendor_amd())
 			lpi_device_get_constraints_amd();
 		else
#1 lore raw
Quoted 9 lines · Rafael J. Wysocki

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

Commit 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed"), that attempted to avoid useless evaluation of LPS0 _DSM Function 1 in lps0_device_attach(), forgot to add checks for lps0_device_handle and sleep_no_lps0 to acpi_s2idle_begin_lps0() where they should be done before calling lpi_device_get_constraints() or lpi_device_get_constraints_amd().

Quoted 4 lines

Add the missing checks.

Fixes 32ece31db4df ("ACPI: PM: s2idle: Only retrieve constraints when needed")
Quoted 19 lines
---
  drivers/acpi/x86/s2idle.c |    3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
drivers/acpi/x86/s2idle.c +2 -1
@@ -515,7 +515,8 @@ static struct acpi_scan_handler lps0_han
 
  static int acpi_s2idle_begin_lps0(void)
  {
-	if (pm_debug_messages_on && !lpi_constraints_table) {
+	if (lps0_device_handle && !sleep_no_lps0 && pm_debug_messages_on &&
+	    !lpi_constraints_table) {
  		if (acpi_s2idle_vendor_amd())
  			lpi_device_get_constraints_amd();
  		else