diff mbox

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

Message ID 1495047894-26620-1-git-send-email-alex.hung@canonical.com
State Accepted
Headers show

Commit Message

Alex Hung May 17, 2017, 7:04 p.m. UTC
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@canonical.com>
---
 src/acpi/method/method.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Colin Ian King May 20, 2017, 1:12 p.m. UTC | #1
On 17/05/17 20:04, Alex Hung wrote:
> 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@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);
> 
Acked-by: Colin Ian King <colin.king@canonical.com>
Ivan Hu May 23, 2017, 8:11 a.m. UTC | #2
On 05/18/2017 03:04 AM, Alex Hung wrote:
> 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@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);
Acked-by: Ivan Hu <ivan.hu@canonical.com>
diff mbox

Patch

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);