Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Build the power resource queue dynamically. Thi...



details:   https://anonhg.NetBSD.org/src/rev/8e59a88b3e67
branches:  trunk
changeset: 755487:8e59a88b3e67
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Mon Jun 07 13:04:31 2010 +0000

description:
Build the power resource queue dynamically. This eliminates the need to call
acpi_power_res_add() in the main scan function, also saving few bytes of
memory.

diffstat:

 sys/dev/acpi/acpi.c       |  15 ++++-----------
 sys/dev/acpi/acpi_power.c |  22 +++++-----------------
 sys/dev/acpi/acpi_power.h |   3 +--
 3 files changed, 10 insertions(+), 30 deletions(-)

diffs (106 lines):

diff -r 6717c08529ff -r 8e59a88b3e67 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Mon Jun 07 11:23:07 2010 +0000
+++ b/sys/dev/acpi/acpi.c       Mon Jun 07 13:04:31 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.200 2010/06/07 01:45:27 pgoyette Exp $      */
+/*     $NetBSD: acpi.c,v 1.201 2010/06/07 13:04:31 jruoho Exp $        */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.200 2010/06/07 01:45:27 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.201 2010/06/07 13:04:31 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -1002,18 +1002,11 @@
                /*
                 * Handled internally.
                 */
-               if (di->Type == ACPI_TYPE_PROCESSOR)
+               if (di->Type == ACPI_TYPE_POWER ||
+                   di->Type == ACPI_TYPE_PROCESSOR)
                        continue;
 
                /*
-                * Ditto, but bind power resources.
-                */
-               if (di->Type == ACPI_TYPE_POWER) {
-                       acpi_power_res_add(ad);
-                       continue;
-               }
-
-               /*
                 * Skip ignored HIDs.
                 */
                if (acpi_match_hid(di, acpi_ignored_ids))
diff -r 6717c08529ff -r 8e59a88b3e67 sys/dev/acpi/acpi_power.c
--- a/sys/dev/acpi/acpi_power.c Mon Jun 07 11:23:07 2010 +0000
+++ b/sys/dev/acpi/acpi_power.c Mon Jun 07 13:04:31 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_power.c,v 1.14 2010/06/05 07:59:13 jruoho Exp $ */
+/* $NetBSD: acpi_power.c,v 1.15 2010/06/07 13:04:31 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.14 2010/06/05 07:59:13 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.15 2010/06/07 13:04:31 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -120,21 +120,6 @@
 static int              acpi_power_sysctl(SYSCTLFN_ARGS);
 static const char      *acpi_xname(ACPI_HANDLE);
 
-void
-acpi_power_res_add(struct acpi_devnode *ad)
-{
-       struct acpi_power_res *res;
-
-       KASSERT(ad != NULL && ad->ad_root != NULL);
-       KASSERT(ad->ad_devinfo->Type == ACPI_TYPE_POWER);
-
-       res = acpi_power_res_init(ad->ad_handle);
-
-       if (res == NULL)
-               aprint_error_dev(ad->ad_root, "failed to "
-                   "add power resource %s\n", ad->ad_name);
-}
-
 static struct acpi_power_res *
 acpi_power_res_init(ACPI_HANDLE hdl)
 {
@@ -190,6 +175,9 @@
        if (tmp == NULL)
                TAILQ_INSERT_TAIL(&res_head, res, res_list);
 
+       ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s added to the "
+               "power resource queue\n", res->res_name));
+
 out:
        if (buf.Pointer != NULL)
                ACPI_FREE(buf.Pointer);
diff -r 6717c08529ff -r 8e59a88b3e67 sys/dev/acpi/acpi_power.h
--- a/sys/dev/acpi/acpi_power.h Mon Jun 07 11:23:07 2010 +0000
+++ b/sys/dev/acpi/acpi_power.h Mon Jun 07 13:04:31 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_power.h,v 1.3 2010/04/24 06:31:44 jruoho Exp $ */
+/* $NetBSD: acpi_power.h,v 1.4 2010/06/07 13:04:31 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -34,7 +34,6 @@
 
 #define ACPI_STATE_ERROR       -1
 
-void   acpi_power_res_add(struct acpi_devnode *);
 bool   acpi_power_register(struct acpi_devnode *);
 void   acpi_power_deregister(struct acpi_devnode *);
 void   acpi_power_deregister_from_handle(ACPI_HANDLE);



Home | Main Index | Thread Index | Old Index