[PATCH] acpi: method: check _WAK & _PTS for supported sleep states only

Alex Hung alex.hung at canonical.com
Wed May 17 19:04:54 UTC 2017


Often not all sleep states are supported. For example, S1 & S2
aren't usually supported by any systems and S3 & S4 aren't usually
supported by servers.

Signed-off-by: Alex Hung <alex.hung at canonical.com>
---
 src/acpi/method/method.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/acpi/method/method.c b/src/acpi/method/method.c
index 61427ec..068aa5e 100644
--- a/src/acpi/method/method.c
+++ b/src/acpi/method/method.c
@@ -6383,6 +6383,11 @@ static int method_test_PTS(fwts_framework *fw)
 
 	for (i = 1; i < 6; i++) {
 		ACPI_OBJECT arg[1];
+		char name[6];
+
+		snprintf(name, sizeof(name), "_S%1d_", i);
+		if (fwts_acpi_object_exists(name) == NULL)
+			continue;
 
 		arg[0].Type = ACPI_TYPE_INTEGER;
 		arg[0].Integer.Value = i;
@@ -6457,6 +6462,12 @@ static int method_test_WAK(fwts_framework *fw)
 
 	for (i = 1; i < 6; i++) {
 		ACPI_OBJECT arg[1];
+		char name[6];
+
+		snprintf(name, sizeof(name), "_S%1d_", i);
+		if (fwts_acpi_object_exists(name) == NULL)
+			continue;
+
 		arg[0].Type = ACPI_TYPE_INTEGER;
 		arg[0].Integer.Value = i;
 		fwts_log_info(fw, "Test _WAK(%d) System Wake, State S%d.", i, i);
-- 
2.7.4




More information about the fwts-devel mailing list