Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/acpi Use acpi_eval_set_integer(), KNF. No funct...



details:   https://anonhg.NetBSD.org/src/rev/68a24b09c303
branches:  trunk
changeset: 756686:68a24b09c303
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Wed Jul 28 18:10:31 2010 +0000

description:
Use acpi_eval_set_integer(), KNF. No functional change.

diffstat:

 sys/arch/x86/acpi/acpi_wakeup.c |  73 ++++++++++++++++++++--------------------
 1 files changed, 37 insertions(+), 36 deletions(-)

diffs (107 lines):

diff -r c5ee190ef19f -r 68a24b09c303 sys/arch/x86/acpi/acpi_wakeup.c
--- a/sys/arch/x86/acpi/acpi_wakeup.c   Wed Jul 28 17:39:54 2010 +0000
+++ b/sys/arch/x86/acpi/acpi_wakeup.c   Wed Jul 28 18:10:31 2010 +0000
@@ -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 <takawata%jp.freebsd.org@localhost>
@@ -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;
-
-       /* run the _PTS and _GTS methods */
+       ACPI_STATUS rv;
+       uint32_t val;
 
-       (void)memset(&ArgList, 0, sizeof(ArgList));
-
-       ArgList.Count = 1;
-       ArgList.Pointer = &Arg;
-
-       (void)memset(&Arg, 0, sizeof(Arg));
+       /*
+        * 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);
 
-       Arg.Type = ACPI_TYPE_INTEGER;
-       Arg.Integer.Value = ACPI_STATE_S4;
-
-       AcpiEvaluateObject(NULL, "\\_PTS", &ArgList, NULL);
-       AcpiEvaluateObject(NULL, "\\_GTS", &ArgList, NULL);
-
-       /* clear wake status */
+       /*
+        * Clear wake status.
+        */
+       (void)AcpiWriteBitRegister(ACPI_BITREG_WAKE_STATUS, 1);
 
-       AcpiWriteBitRegister(ACPI_BITREG_WAKE_STATUS, 1);
+       /*
+        * Enable wake GPEs.
+        */
+       (void)AcpiHwDisableAllGpes();
+       (void)AcpiHwEnableAllWakeupGpes();
 
-       AcpiHwDisableAllGpes();
-       AcpiHwEnableAllWakeupGpes();
-
-       /* flush caches */
-
+       /*
+        * 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);
+
+       } while (val == 0);
 
-       AcpiHwDisableAllGpes();
-       AcpiHwEnableAllRuntimeGpes();
+       /*
+        * Enable runtime GPEs.
+        */
+       (void)AcpiHwDisableAllGpes();
+       (void)AcpiHwEnableAllRuntimeGpes();
 
-       return (AE_OK);
+       return AE_OK;
 }
 
 void



Home | Main Index | Thread Index | Old Index