Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Rename acpi_get_node() to acpi_match_node() for...



details:   https://anonhg.NetBSD.org/src/rev/babe95b4fc5b
branches:  trunk
changeset: 766347:babe95b4fc5b
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Tue Jun 21 03:37:21 2011 +0000

description:
Rename acpi_get_node() to acpi_match_node() for consistency.

diffstat:

 sys/dev/acpi/acpi.c       |   6 +-
 sys/dev/acpi/acpi_cpu.c   |   6 +-
 sys/dev/acpi/acpi_pmtr.c  |   6 +-
 sys/dev/acpi/acpi_power.c |  10 ++--
 sys/dev/acpi/acpi_util.c  |  79 +++++++++++++++++++++++-----------------------
 sys/dev/acpi/acpi_util.h  |   6 +-
 sys/dev/acpi/acpivar.h    |   4 +-
 7 files changed, 58 insertions(+), 59 deletions(-)

diffs (273 lines):

diff -r 44f3ac6058dd -r babe95b4fc5b sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c       Tue Jun 21 03:02:57 2011 +0000
+++ b/sys/dev/acpi/acpi.c       Tue Jun 21 03:37:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi.c,v 1.245 2011/06/14 13:59:23 jruoho Exp $        */
+/*     $NetBSD: acpi.c,v 1.246 2011/06/21 03:37:21 jruoho Exp $        */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -100,7 +100,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.245 2011/06/14 13:59:23 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.246 2011/06/21 03:37:21 jruoho Exp $");
 
 #include "opt_acpi.h"
 #include "opt_pcifixup.h"
@@ -685,7 +685,7 @@
                ad->ad_root = sc->sc_dev;
                ad->ad_parent = awc->aw_parent;
 
-               acpi_set_node(ad);
+               acpi_match_node_init(ad);
                acpi_make_name(ad, devinfo->Name);
 
                /*
diff -r 44f3ac6058dd -r babe95b4fc5b sys/dev/acpi/acpi_cpu.c
--- a/sys/dev/acpi/acpi_cpu.c   Tue Jun 21 03:02:57 2011 +0000
+++ b/sys/dev/acpi/acpi_cpu.c   Tue Jun 21 03:37:21 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_cpu.c,v 1.42 2011/06/20 15:33:49 jruoho Exp $ */
+/* $NetBSD: acpi_cpu.c,v 1.43 2011/06/21 03:37:21 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2010, 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.42 2011/06/20 15:33:49 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_cpu.c,v 1.43 2011/06/21 03:37:21 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -147,7 +147,7 @@
                return;
        }
 
-       sc->sc_node = acpi_get_node(hdl);
+       sc->sc_node = acpi_match_node(hdl);
 
        if (acpicpu_once_attach() != 0) {
                aprint_normal(": failed to initialize\n");
diff -r 44f3ac6058dd -r babe95b4fc5b sys/dev/acpi/acpi_pmtr.c
--- a/sys/dev/acpi/acpi_pmtr.c  Tue Jun 21 03:02:57 2011 +0000
+++ b/sys/dev/acpi/acpi_pmtr.c  Tue Jun 21 03:37:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_pmtr.c,v 1.5 2011/06/20 17:21:50 pgoyette Exp $ */
+/*     $NetBSD: acpi_pmtr.c,v 1.6 2011/06/21 03:37:21 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2011 Jukka Ruohonen <jruohonen%iki.fi@localhost>
@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_pmtr.c,v 1.5 2011/06/20 17:21:50 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_pmtr.c,v 1.6 2011/06/21 03:37:21 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/module.h>
@@ -292,7 +292,7 @@
                if (ACPI_FAILURE(rv))
                        continue;
 
-               ad = acpi_get_node(hdl);
+               ad = acpi_match_node(hdl);
 
                if (ad == NULL)
                        continue;
diff -r 44f3ac6058dd -r babe95b4fc5b sys/dev/acpi/acpi_power.c
--- a/sys/dev/acpi/acpi_power.c Tue Jun 21 03:02:57 2011 +0000
+++ b/sys/dev/acpi/acpi_power.c Tue Jun 21 03:37:21 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_power.c,v 1.31 2011/05/22 22:13:33 joerg Exp $ */
+/* $NetBSD: acpi_power.c,v 1.32 2011/06/21 03:37:21 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.31 2011/05/22 22:13:33 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.32 2011/06/21 03:37:21 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/kmem.h>
@@ -199,7 +199,7 @@
 void
 acpi_power_deregister(ACPI_HANDLE hdl)
 {
-       struct acpi_devnode *ad = acpi_get_node(hdl);
+       struct acpi_devnode *ad = acpi_match_node(hdl);
        struct acpi_power_res *res;
 
        if (ad == NULL)
@@ -218,7 +218,7 @@
 bool
 acpi_power_get(ACPI_HANDLE hdl, int *state)
 {
-       struct acpi_devnode *ad = acpi_get_node(hdl);
+       struct acpi_devnode *ad = acpi_match_node(hdl);
        ACPI_STATUS rv;
 
        if (ad == NULL)
@@ -331,7 +331,7 @@
 bool
 acpi_power_set(ACPI_HANDLE hdl, int state)
 {
-       struct acpi_devnode *ad = acpi_get_node(hdl);
+       struct acpi_devnode *ad = acpi_match_node(hdl);
        ACPI_STATUS rv;
        char path[5];
        int old;
diff -r 44f3ac6058dd -r babe95b4fc5b sys/dev/acpi/acpi_util.c
--- a/sys/dev/acpi/acpi_util.c  Tue Jun 21 03:02:57 2011 +0000
+++ b/sys/dev/acpi/acpi_util.c  Tue Jun 21 03:37:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_util.c,v 1.7 2011/06/20 15:31:52 jruoho Exp $ */
+/*     $NetBSD: acpi_util.c,v 1.8 2011/06/21 03:37:21 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.7 2011/06/20 15:31:52 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_util.c,v 1.8 2011/06/21 03:37:21 jruoho Exp $");
 
 #include <sys/param.h>
 
@@ -273,42 +273,6 @@
 }
 
 /*
- * Get a device node from a handle.
- */
-struct acpi_devnode *
-acpi_get_node(ACPI_HANDLE handle)
-{
-       struct acpi_devnode *ad;
-       ACPI_STATUS rv;
-
-       if (handle == NULL)
-               return NULL;
-
-       rv = AcpiGetData(handle, acpi_clean_node, (void **)&ad);
-
-       if (ACPI_FAILURE(rv))
-               return NULL;
-
-       return ad;
-}
-
-/*
- * Associate a device node with a handle.
- */
-void
-acpi_set_node(struct acpi_devnode *ad)
-{
-
-       (void)AcpiAttachData(ad->ad_handle, acpi_clean_node, ad);
-}
-
-static void
-acpi_clean_node(ACPI_HANDLE handle, void *aux)
-{
-       /* Nothing. */
-}
-
-/*
  * Return a complete pathname from a handle.
  *
  * Note that the function uses static data storage;
@@ -373,10 +337,45 @@
 }
 
 /*
+ * Match a device node from a handle.
+ */
+struct acpi_devnode *
+acpi_match_node(ACPI_HANDLE handle)
+{
+       struct acpi_devnode *ad;
+       ACPI_STATUS rv;
+
+       if (handle == NULL)
+               return NULL;
+
+       rv = AcpiGetData(handle, acpi_clean_node, (void **)&ad);
+
+       if (ACPI_FAILURE(rv))
+               return NULL;
+
+       return ad;
+}
+
+/*
+ * Permanently associate a device node with a handle.
+ */
+void
+acpi_match_node_init(struct acpi_devnode *ad)
+{
+       (void)AcpiAttachData(ad->ad_handle, acpi_clean_node, ad);
+}
+
+static void
+acpi_clean_node(ACPI_HANDLE handle, void *aux)
+{
+       /* Nothing. */
+}
+
+/*
  * Match a handle from a cpu_info. Returns NULL on failure.
  *
- * Note that if also acpi_devnode is needed, a subsequent
- * call to acpi_get_node() will work.
+ * Note that acpi_match_node() can be used if the device node
+ * is also required.
  */
 ACPI_HANDLE
 acpi_match_cpu_info(struct cpu_info *ci)
diff -r 44f3ac6058dd -r babe95b4fc5b sys/dev/acpi/acpi_util.h
--- a/sys/dev/acpi/acpi_util.h  Tue Jun 21 03:02:57 2011 +0000
+++ b/sys/dev/acpi/acpi_util.h  Tue Jun 21 03:37:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_util.h,v 1.4 2011/06/20 15:31:52 jruoho Exp $ */
+/*     $NetBSD: acpi_util.h,v 1.5 2011/06/21 03:37:21 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -79,8 +79,8 @@
 ACPI_STATUS    acpi_get(ACPI_HANDLE, ACPI_BUFFER *,
                        ACPI_STATUS (*)(ACPI_HANDLE, ACPI_BUFFER *));
 
-struct acpi_devnode *acpi_get_node(ACPI_HANDLE handle);
-void                acpi_set_node(struct acpi_devnode *ad);
+struct acpi_devnode *acpi_match_node(ACPI_HANDLE handle);
+void                acpi_match_node_init(struct acpi_devnode *ad);
 
 const char     *acpi_name(ACPI_HANDLE);
 int             acpi_match_hid(ACPI_DEVICE_INFO *, const char * const *);
diff -r 44f3ac6058dd -r babe95b4fc5b sys/dev/acpi/acpivar.h
--- a/sys/dev/acpi/acpivar.h    Tue Jun 21 03:02:57 2011 +0000
+++ b/sys/dev/acpi/acpivar.h    Tue Jun 21 03:37:21 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpivar.h,v 1.71 2011/06/15 09:02:38 jruoho Exp $      */
+/*     $NetBSD: acpivar.h,v 1.72 2011/06/21 03:37:21 jruoho Exp $      */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -114,7 +114,7 @@
  *     ad_handle       never NULL
  *
  * Each ACPI device node is associated with its handle. The function
- * acpi_get_node() can be used to get the node structure from a handle.
+ * acpi_match_node() can be used to get the node structure from a handle.
  */
 struct acpi_devnode {
        device_t                 ad_device;     /* Device */



Home | Main Index | Thread Index | Old Index