Module Name:    src
Committed By:   jruoho
Date:           Wed Jul 28 18:10:32 UTC 2010

Modified Files:
        src/sys/arch/x86/acpi: acpi_wakeup.c

Log Message:
Use acpi_eval_set_integer(), KNF. No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/x86/acpi/acpi_wakeup.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/x86/acpi/acpi_wakeup.c
diff -u src/sys/arch/x86/acpi/acpi_wakeup.c:1.23 src/sys/arch/x86/acpi/acpi_wakeup.c:1.24
--- src/sys/arch/x86/acpi/acpi_wakeup.c:1.23	Wed Apr 14 19:32:35 2010
+++ src/sys/arch/x86/acpi/acpi_wakeup.c	Wed Jul 28 18:10:31 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_wakeup.c,v 1.23 2010/04/14 19:32:35 jruoho Exp $	*/
+/*	$NetBSD: acpi_wakeup.c,v 1.24 2010/07/28 18:10:31 jruoho Exp $	*/
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.23 2010/04/14 19:32:35 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.24 2010/07/28 18:10:31 jruoho Exp $");
 
 /*-
  * Copyright (c) 2001 Takanori Watanabe <[email protected]>
@@ -188,53 +188,54 @@
 static ACPI_STATUS
 enter_s4_with_bios(void)
 {
-	ACPI_OBJECT_LIST	ArgList;
-	ACPI_OBJECT		Arg;
-	uint32_t		ret;
-	ACPI_STATUS		status;
+	ACPI_STATUS rv;
+	uint32_t val;
 
-	/* run the _PTS and _GTS methods */
-
-	(void)memset(&ArgList, 0, sizeof(ArgList));
-
-	ArgList.Count = 1;
-	ArgList.Pointer = &Arg;
-
-	(void)memset(&Arg, 0, sizeof(Arg));
-
-	Arg.Type = ACPI_TYPE_INTEGER;
-	Arg.Integer.Value = ACPI_STATE_S4;
-
-	AcpiEvaluateObject(NULL, "\\_PTS", &ArgList, NULL);
-	AcpiEvaluateObject(NULL, "\\_GTS", &ArgList, NULL);
-
-	/* clear wake status */
-
-	AcpiWriteBitRegister(ACPI_BITREG_WAKE_STATUS, 1);
+	/*
+	 * Run the _PTS and _GTS methods.
+	 */
+	(void)acpi_eval_set_integer(NULL, "\\_PTS", ACPI_STATE_S4);
+	(void)acpi_eval_set_integer(NULL, "\\_GTS", ACPI_STATE_S4);
 
-	AcpiHwDisableAllGpes();
-	AcpiHwEnableAllWakeupGpes();
+	/*
+	 * Clear wake status.
+	 */
+	(void)AcpiWriteBitRegister(ACPI_BITREG_WAKE_STATUS, 1);
 
-	/* flush caches */
+	/*
+	 * Enable wake GPEs.
+	 */
+	(void)AcpiHwDisableAllGpes();
+	(void)AcpiHwEnableAllWakeupGpes();
 
+	/*
+	 * Flush caches.
+	 */
 	ACPI_FLUSH_CPU_CACHE();
 
 	/*
-	 * write the value to command port and wait until we enter sleep state
+	 * Write the value to command port and wait until we enter sleep state.
 	 */
 	do {
 		AcpiOsStall(1000000);
-		AcpiOsWritePort(AcpiGbl_FADT.SmiCommand,
-				AcpiGbl_FADT.S4BiosRequest, 8);
-		status = AcpiReadBitRegister(ACPI_BITREG_WAKE_STATUS, &ret);
-		if (ACPI_FAILURE(status))
+
+		(void)AcpiOsWritePort(AcpiGbl_FADT.SmiCommand,
+				      AcpiGbl_FADT.S4BiosRequest, 8);
+
+		rv = AcpiReadBitRegister(ACPI_BITREG_WAKE_STATUS, &val);
+
+		if (ACPI_FAILURE(rv))
 			break;
-	} while (!ret);
 
-	AcpiHwDisableAllGpes();
-	AcpiHwEnableAllRuntimeGpes();
+	} while (val == 0);
+
+	/*
+	 * Enable runtime GPEs.
+	 */
+	(void)AcpiHwDisableAllGpes();
+	(void)AcpiHwEnableAllRuntimeGpes();
 
-	return (AE_OK);
+	return AE_OK;
 }
 
 void

Reply via email to