summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/dsdt.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2012-07-16 15:27:12 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2012-07-16 15:27:12 +0000
commited3c79f0b292ba248262133ed5e2e3805a7a59a7 (patch)
treea8820d5931efc79edf688ebae61ad6ad23863231 /sys/dev/acpi/dsdt.c
parentefa923b1ebe2949f7a92c771d6c0e053e8a5afea (diff)
Add shorter form function aml_node_setval() for setting an int
on an AML node. Shortens the tricky code in a lot of callers. Earlier version seen by pirofti and kettenis.
Diffstat (limited to 'sys/dev/acpi/dsdt.c')
-rw-r--r--sys/dev/acpi/dsdt.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/sys/dev/acpi/dsdt.c b/sys/dev/acpi/dsdt.c
index 7efe0a1fd56..fb70fb0e3fa 100644
--- a/sys/dev/acpi/dsdt.c
+++ b/sys/dev/acpi/dsdt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dsdt.c,v 1.196 2012/07/10 15:57:41 pirofti Exp $ */
+/* $OpenBSD: dsdt.c,v 1.197 2012/07/16 15:27:11 deraadt Exp $ */
/*
* Copyright (c) 2005 Jordan Hargrave <jordan@openbsd.org>
*
@@ -4058,6 +4058,21 @@ aml_evalnode(struct acpi_softc *sc, struct aml_node *node,
return (0);
}
+int
+aml_node_setval(struct acpi_softc *sc, struct aml_node *node, int64_t val)
+{
+ struct aml_value env;
+
+ if (!node)
+ return (0);
+
+ memset(&env, 0, sizeof(env));
+ env.type = AML_OBJTYPE_INTEGER;
+ env.v_integer = val;
+
+ return aml_evalnode(sc, node, 1, &env, NULL);
+}
+
/*
* evaluate an AML name
* Returns a copy of the value in res (must be freed by user)