diff options
author | Marco Peereboom <marco@cvs.openbsd.org> | 2010-07-27 04:28:37 +0000 |
---|---|---|
committer | Marco Peereboom <marco@cvs.openbsd.org> | 2010-07-27 04:28:37 +0000 |
commit | b749a540a9a87f13988fde7c3cbd674c28fee631 (patch) | |
tree | 83967225ffbd5727fef3834ee441606554170a2f /sys | |
parent | ece0040ebc485965466faf94ac2538e6768b608a (diff) |
replace acpitz_getreading goo with proper aml_evalinteger.
From jordan.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/acpi/acpitz.c | 29 |
1 files changed, 6 insertions, 23 deletions
diff --git a/sys/dev/acpi/acpitz.c b/sys/dev/acpi/acpitz.c index c5c5ea8aecc..b7fd426951e 100644 --- a/sys/dev/acpi/acpitz.c +++ b/sys/dev/acpi/acpitz.c @@ -1,4 +1,4 @@ -/* $OpenBSD: acpitz.c,v 1.38 2010/07/21 19:35:15 deraadt Exp $ */ +/* $OpenBSD: acpitz.c,v 1.39 2010/07/27 04:28:36 marco Exp $ */ /* * Copyright (c) 2006 Can Erkin Acar <canacar@openbsd.org> * Copyright (c) 2005 Marco Peereboom <marco@openbsd.org> @@ -400,29 +400,12 @@ acpitz_refresh(void *arg) int acpitz_getreading(struct acpitz_softc *sc, char *name) { - struct aml_value res, *ref; - int rv = -1; + u_int64_t val; - if (aml_evalname(sc->sc_acpi, sc->sc_devnode, name, 0, NULL, &res)) { - dnprintf(10, "%s: acpitz_getreading: no %s\n", DEVNAME(sc), - name); - goto out; - } - if (res.type == AML_OBJTYPE_STRING) { - struct aml_node *node; - node = aml_searchrel(sc->sc_devnode, res.v_string); - if (node == NULL) - goto out; - ref = node->value; - } else - ref = &res; - if (ref->type == AML_OBJTYPE_OBJREF) { - ref = ref->v_objref.ref; - } - rv = aml_val2int(ref); -out: - aml_freevalue(&res); - return (rv); + if (!aml_evalinteger(sc->sc_acpi, sc->sc_devnode, name, 0, NULL, &val)) + return (val); + + return (-1); } int |