Rename acpi_get_node() to acpi_match_node() for consistency.

This commit is contained in:
jruoho 2011-06-21 03:37:21 +00:00
parent 706138d7ee
commit a9db528e18
7 changed files with 58 additions and 59 deletions

View File

@ -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 @@ acpi_make_devnode(ACPI_HANDLE handle, uint32_t level,
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);
/*

View File

@ -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>
@ -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 @@ acpicpu_attach(device_t parent, device_t self, void *aux)
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");

View File

@ -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>
@ -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 @@ acpipmtr_dev_print(device_t self)
if (ACPI_FAILURE(rv))
continue;
ad = acpi_get_node(hdl);
ad = acpi_match_node(hdl);
if (ad == NULL)
continue;

View File

@ -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 @@ acpi_power_register(ACPI_HANDLE hdl)
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 @@ acpi_power_deregister(ACPI_HANDLE hdl)
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 @@ out:
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;

View File

@ -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>
@ -272,42 +272,6 @@ acpi_get(ACPI_HANDLE handle, ACPI_BUFFER *buf,
return (*getit)(handle, buf);
}
/*
* 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.
*
@ -372,11 +336,46 @@ acpi_match_hid(ACPI_DEVICE_INFO *ad, const char * const *ids)
return 0;
}
/*
* 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)

View File

@ -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_foreach_package_object(ACPI_OBJECT *,
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 *);

View File

@ -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 @@ struct acpi_pci_info {
* 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 */