Module Name: src Committed By: jruoho Date: Tue Jun 21 03:37:21 UTC 2011
Modified Files: src/sys/dev/acpi: acpi.c acpi_cpu.c acpi_pmtr.c acpi_power.c acpi_util.c acpi_util.h acpivar.h Log Message: Rename acpi_get_node() to acpi_match_node() for consistency. To generate a diff of this commit: cvs rdiff -u -r1.245 -r1.246 src/sys/dev/acpi/acpi.c cvs rdiff -u -r1.42 -r1.43 src/sys/dev/acpi/acpi_cpu.c cvs rdiff -u -r1.5 -r1.6 src/sys/dev/acpi/acpi_pmtr.c cvs rdiff -u -r1.31 -r1.32 src/sys/dev/acpi/acpi_power.c cvs rdiff -u -r1.7 -r1.8 src/sys/dev/acpi/acpi_util.c cvs rdiff -u -r1.4 -r1.5 src/sys/dev/acpi/acpi_util.h cvs rdiff -u -r1.71 -r1.72 src/sys/dev/acpi/acpivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/acpi/acpi.c diff -u src/sys/dev/acpi/acpi.c:1.245 src/sys/dev/acpi/acpi.c:1.246 --- src/sys/dev/acpi/acpi.c:1.245 Tue Jun 14 13:59:23 2011 +++ src/sys/dev/acpi/acpi.c Tue Jun 21 03:37:21 2011 @@ -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); /* Index: src/sys/dev/acpi/acpi_cpu.c diff -u src/sys/dev/acpi/acpi_cpu.c:1.42 src/sys/dev/acpi/acpi_cpu.c:1.43 --- src/sys/dev/acpi/acpi_cpu.c:1.42 Mon Jun 20 15:33:49 2011 +++ src/sys/dev/acpi/acpi_cpu.c Tue Jun 21 03:37:21 2011 @@ -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 <jruoho...@iki.fi> @@ -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"); Index: src/sys/dev/acpi/acpi_pmtr.c diff -u src/sys/dev/acpi/acpi_pmtr.c:1.5 src/sys/dev/acpi/acpi_pmtr.c:1.6 --- src/sys/dev/acpi/acpi_pmtr.c:1.5 Mon Jun 20 17:21:50 2011 +++ src/sys/dev/acpi/acpi_pmtr.c Tue Jun 21 03:37:21 2011 @@ -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 <jruoho...@iki.fi> @@ -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; Index: src/sys/dev/acpi/acpi_power.c diff -u src/sys/dev/acpi/acpi_power.c:1.31 src/sys/dev/acpi/acpi_power.c:1.32 --- src/sys/dev/acpi/acpi_power.c:1.31 Sun May 22 22:13:33 2011 +++ src/sys/dev/acpi/acpi_power.c Tue Jun 21 03:37:21 2011 @@ -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; Index: src/sys/dev/acpi/acpi_util.c diff -u src/sys/dev/acpi/acpi_util.c:1.7 src/sys/dev/acpi/acpi_util.c:1.8 --- src/sys/dev/acpi/acpi_util.c:1.7 Mon Jun 20 15:31:52 2011 +++ src/sys/dev/acpi/acpi_util.c Tue Jun 21 03:37:21 2011 @@ -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) Index: src/sys/dev/acpi/acpi_util.h diff -u src/sys/dev/acpi/acpi_util.h:1.4 src/sys/dev/acpi/acpi_util.h:1.5 --- src/sys/dev/acpi/acpi_util.h:1.4 Mon Jun 20 15:31:52 2011 +++ src/sys/dev/acpi/acpi_util.h Tue Jun 21 03:37:21 2011 @@ -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 *); Index: src/sys/dev/acpi/acpivar.h diff -u src/sys/dev/acpi/acpivar.h:1.71 src/sys/dev/acpi/acpivar.h:1.72 --- src/sys/dev/acpi/acpivar.h:1.71 Wed Jun 15 09:02:38 2011 +++ src/sys/dev/acpi/acpivar.h Tue Jun 21 03:37:21 2011 @@ -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 */