Patchwork [1/2] acpi: wakealarm: enable for non-x86 devices (LP: #1182630)

login
register
mail settings
Submitter Colin King
Date June 3, 2013, 9:15 a.m.
Message ID <1370250917-3561-2-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/248209/
State Accepted
Headers show

Comments

Colin King - June 3, 2013, 9:15 a.m.
From: Colin Ian King <colin.king@canonical.com>

Some non-x86 devices support wakealarm, so remove the x86 only
restriction.  Make tests 2..4 abort if test 1 detects no wakealarm
interface rather than tripping failures.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpi/wakealarm/wakealarm.c | 20 +++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)
Keng-Yu Lin - June 4, 2013, 6:36 a.m.
On Mon, Jun 3, 2013 at 5:15 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Some non-x86 devices support wakealarm, so remove the x86 only
> restriction.  Make tests 2..4 abort if test 1 detects no wakealarm
> interface rather than tripping failures.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpi/wakealarm/wakealarm.c | 20 +++++++++++++++-----
>  1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/src/acpi/wakealarm/wakealarm.c b/src/acpi/wakealarm/wakealarm.c
> index 5873483..b9736ca 100644
> --- a/src/acpi/wakealarm/wakealarm.c
> +++ b/src/acpi/wakealarm/wakealarm.c
> @@ -18,8 +18,6 @@
>   */
>  #include "fwts.h"
>
> -#ifdef FWTS_ARCH_INTEL
> -
>  #include <stdlib.h>
>  #include <stdio.h>
>  #include <sys/types.h>
> @@ -35,9 +33,23 @@ static int wakealarm_test1(fwts_framework *fw)
>
>         if (stat(wkalarm, &buf) == 0)
>                 fwts_passed(fw, WAKEALARM " found.");
> -       else
> +       else {
>                 fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoWakeAlarmTest1",
>                         "Could not find " WAKEALARM ".");
> +#ifdef FWTS_ARCH_INTEL
> +               /* For x86 devices, this is considered a failure */
> +               fwts_advice(fw,
> +                       "x86 devices generally should have an RTC wake alarm that "
> +                       "is normally controlled by the " WAKEALARM " interface. This interface "
> +                       "does not exist, so the wake alarm tests will be aborted.");
> +#else
> +               fwts_advice(fw,
> +                       "non-x86 devices sometimes do not have an RTC wake alarm that "
> +                       "is normally controlled by the " WAKEALARM " interface. This "
> +                       "interface does not exist, so the wake alarm tests will be aborted.");
> +#endif
> +               return FWTS_ABORTED;
> +       }
>
>         return FWTS_OK;
>  }
> @@ -123,5 +135,3 @@ static fwts_framework_ops wakealarm_ops = {
>  };
>
>  FWTS_REGISTER("wakealarm", &wakealarm_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV);
> -
> -#endif
> --
> 1.8.1.2
>

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Ivan Hu - June 4, 2013, 7:14 a.m.
On 06/03/2013 05:15 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Some non-x86 devices support wakealarm, so remove the x86 only
> restriction.  Make tests 2..4 abort if test 1 detects no wakealarm
> interface rather than tripping failures.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/acpi/wakealarm/wakealarm.c | 20 +++++++++++++++-----
>   1 file changed, 15 insertions(+), 5 deletions(-)
>
> diff --git a/src/acpi/wakealarm/wakealarm.c b/src/acpi/wakealarm/wakealarm.c
> index 5873483..b9736ca 100644
> --- a/src/acpi/wakealarm/wakealarm.c
> +++ b/src/acpi/wakealarm/wakealarm.c
> @@ -18,8 +18,6 @@
>    */
>   #include "fwts.h"
>
> -#ifdef FWTS_ARCH_INTEL
> -
>   #include <stdlib.h>
>   #include <stdio.h>
>   #include <sys/types.h>
> @@ -35,9 +33,23 @@ static int wakealarm_test1(fwts_framework *fw)
>
>   	if (stat(wkalarm, &buf) == 0)
>   		fwts_passed(fw, WAKEALARM " found.");
> -	else
> +	else {
>   		fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoWakeAlarmTest1",
>   			"Could not find " WAKEALARM ".");
> +#ifdef FWTS_ARCH_INTEL
> +		/* For x86 devices, this is considered a failure */
> +		fwts_advice(fw,
> +			"x86 devices generally should have an RTC wake alarm that "
> +			"is normally controlled by the " WAKEALARM " interface. This interface "
> +			"does not exist, so the wake alarm tests will be aborted.");
> +#else
> +		fwts_advice(fw,
> +			"non-x86 devices sometimes do not have an RTC wake alarm that "
> +			"is normally controlled by the " WAKEALARM " interface. This "
> +			"interface does not exist, so the wake alarm tests will be aborted.");
> +#endif
> +		return FWTS_ABORTED;
> +	}
>
>   	return FWTS_OK;
>   }
> @@ -123,5 +135,3 @@ static fwts_framework_ops wakealarm_ops = {
>   };
>
>   FWTS_REGISTER("wakealarm", &wakealarm_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV);
> -
> -#endif
>

Acked-by: Ivan Hu <ivan.hu@canonical.com>

Patch

diff --git a/src/acpi/wakealarm/wakealarm.c b/src/acpi/wakealarm/wakealarm.c
index 5873483..b9736ca 100644
--- a/src/acpi/wakealarm/wakealarm.c
+++ b/src/acpi/wakealarm/wakealarm.c
@@ -18,8 +18,6 @@ 
  */
 #include "fwts.h"
 
-#ifdef FWTS_ARCH_INTEL
-
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/types.h>
@@ -35,9 +33,23 @@  static int wakealarm_test1(fwts_framework *fw)
 
 	if (stat(wkalarm, &buf) == 0)
 		fwts_passed(fw, WAKEALARM " found.");
-	else
+	else {
 		fwts_failed(fw, LOG_LEVEL_MEDIUM, "NoWakeAlarmTest1",
 			"Could not find " WAKEALARM ".");
+#ifdef FWTS_ARCH_INTEL
+		/* For x86 devices, this is considered a failure */
+		fwts_advice(fw,
+			"x86 devices generally should have an RTC wake alarm that "
+			"is normally controlled by the " WAKEALARM " interface. This interface "
+			"does not exist, so the wake alarm tests will be aborted.");
+#else
+		fwts_advice(fw,
+			"non-x86 devices sometimes do not have an RTC wake alarm that "
+			"is normally controlled by the " WAKEALARM " interface. This "
+			"interface does not exist, so the wake alarm tests will be aborted.");
+#endif
+		return FWTS_ABORTED;
+	}
 
 	return FWTS_OK;
 }
@@ -123,5 +135,3 @@  static fwts_framework_ops wakealarm_ops = {
 };
 
 FWTS_REGISTER("wakealarm", &wakealarm_ops, FWTS_TEST_ANYTIME, FWTS_FLAG_BATCH | FWTS_FLAG_ROOT_PRIV);
-
-#endif