From 409e6d040902b288bff59be677f5325df5a3820a Mon Sep 17 00:00:00 2001 From: marco Date: Tue, 27 Jul 2010 04:28:36 +0000 Subject: [PATCH] replace acpitz_getreading goo with proper aml_evalinteger. From jordan. --- sys/dev/acpi/acpitz.c | 29 ++++++----------------------- 1 file 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 * Copyright (c) 2005 Marco Peereboom @@ -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 -- 2.20.1