summaryrefslogtreecommitdiff
path: root/sys/dev
diff options
context:
space:
mode:
authorJordan Hargrave <jordan@cvs.openbsd.org>2010-06-27 21:04:23 +0000
committerJordan Hargrave <jordan@cvs.openbsd.org>2010-06-27 21:04:23 +0000
commit61395933c79a99c7cb8782f2c547964749942f99 (patch)
tree6f8074cf0f43e7fa4d082b86f2238d3c60b5501e /sys/dev
parentecf49c7fa3d9dd632ffaa88832f9578c3086b13c (diff)
Change ACPI namespace to use SIMPLEQ macros
ok mlarkin
Diffstat (limited to 'sys/dev')
-rw-r--r--sys/dev/acpi/acpidebug.c9
-rw-r--r--sys/dev/acpi/amltypes.h7
-rw-r--r--sys/dev/acpi/dsdt.c28
3 files changed, 23 insertions, 21 deletions
diff --git a/sys/dev/acpi/acpidebug.c b/sys/dev/acpi/acpidebug.c
index 0f3f81e4579..0f44ed5307b 100644
--- a/sys/dev/acpi/acpidebug.c
+++ b/sys/dev/acpi/acpidebug.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpidebug.c,v 1.23 2009/05/30 22:49:56 jordan Exp $ */
+/* $OpenBSD: acpidebug.c,v 1.24 2010/06/27 21:04:22 jordan Exp $ */
/*
* Copyright (c) 2006 Marco Peereboom <marco@openbsd.org>
*
@@ -238,9 +238,8 @@ db_aml_walktree(struct aml_node *node)
{
while (node) {
db_aml_showvalue(node->value);
- db_aml_walktree(node->child);
-
- node = node->sibling;
+ db_aml_walktree(SIMPLEQ_FIRST(&node->son));
+ node = SIMPLEQ_NEXT(node, sib);
}
}
@@ -334,7 +333,7 @@ db_acpi_disasm(db_expr_t addr, int haddr, db_expr_t count, char *modif)
void
db_acpi_tree(db_expr_t addr, int haddr, db_expr_t count, char *modif)
{
- db_aml_walktree(aml_root.child);
+ db_aml_walktree(&aml_root);
}
void
diff --git a/sys/dev/acpi/amltypes.h b/sys/dev/acpi/amltypes.h
index a5259e74c22..5bea7d0c9e9 100644
--- a/sys/dev/acpi/amltypes.h
+++ b/sys/dev/acpi/amltypes.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: amltypes.h,v 1.33 2009/07/17 21:44:48 jordan Exp $ */
+/* $OpenBSD: amltypes.h,v 1.34 2010/06/27 21:04:22 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -349,8 +349,9 @@ struct aml_value {
struct aml_node {
struct aml_node *parent;
- struct aml_node *child;
- struct aml_node *sibling;
+
+ SIMPLEQ_HEAD(,aml_node) son;
+ SIMPLEQ_ENTRY(aml_node) sib;
char name[5];
u_int16_t opcode;
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index b8324352819..b26fb31875f 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.159 2010/06/27 07:26:31 jordan Exp $ */
+/* $OpenBSD: dsdt.c,v 1.160 2010/06/27 21:04:22 jordan Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -606,16 +606,16 @@ void aml_delchildren(struct aml_node *);
struct aml_node *
__aml_search(struct aml_node *root, uint8_t *nameseg, int create)
{
- struct aml_node **sp, *node;
+ struct aml_node *node;
/* XXX: Replace with SLIST/SIMPLEQ routines */
if (root == NULL)
return NULL;
//rw_enter_read(&aml_nslock);
- for (sp = &root->child; *sp; sp = &(*sp)->sibling) {
- if (!strncmp((*sp)->name, nameseg, AML_NAMESEG_LEN)) {
+ SIMPLEQ_FOREACH(node, &root->son, sib) {
+ if (!strncmp(node->name, nameseg, AML_NAMESEG_LEN)) {
//rw_exit_read(&aml_nslock);
- return *sp;
+ return node;
}
}
//rw_exit_read(&aml_nslock);
@@ -625,13 +625,14 @@ __aml_search(struct aml_node *root, uint8_t *nameseg, int create)
node->value = aml_allocvalue(0,0,NULL);
node->value->node = node;
node->parent = root;
- node->sibling = NULL;
+
+ SIMPLEQ_INIT(&node->son);
+ SIMPLEQ_INSERT_TAIL(&root->son, node, sib);
//rw_enter_write(&aml_nslock);
- *sp = node;
//rw_exit_write(&aml_nslock);
}
- return *sp;
+ return node;
}
/* Get absolute pathname of AML node */
@@ -694,8 +695,8 @@ aml_delchildren(struct aml_node *node)
if (node == NULL)
return;
- while ((onode = node->child) != NULL) {
- node->child = onode->sibling;
+ while ((onode = SIMPLEQ_FIRST(&node->son)) != NULL) {
+ SIMPLEQ_REMOVE_HEAD(&node->son, sib);
aml_delchildren(onode);
@@ -1234,7 +1235,7 @@ aml_walknodes(struct aml_node *node, int mode,
return;
if (mode == AML_WALK_PRE)
nodecb(node, arg);
- for (child = node->child; child; child = child->sibling)
+ SIMPLEQ_FOREACH(child, &node->son, sib)
aml_walknodes(child, mode, nodecb, arg);
if (mode == AML_WALK_POST)
nodecb(node, arg);
@@ -1256,8 +1257,8 @@ aml_find_node(struct aml_node *node, const char *name,
}
/* Only recurse if cbproc() wants us to */
if (!st)
- aml_find_node(node->child, name, cbproc, arg);
- node = node->sibling;
+ aml_find_node(SIMPLEQ_FIRST(&node->son), name, cbproc, arg);
+ node = SIMPLEQ_NEXT(node, sib);
}
return st;
}
@@ -1498,6 +1499,7 @@ aml_create_defaultobjects()
osstring[15] = 'w';
osstring[18] = 'N';
+ SIMPLEQ_INIT(&aml_root.son);
strlcpy(aml_root.name, "\\", sizeof(aml_root.name));
aml_root.value = aml_allocvalue(0, 0, NULL);
aml_root.value->node = &aml_root;