Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Replace all AcpiEvaluateObject() calls with acp...
details: https://anonhg.NetBSD.org/src/rev/d959e61d9d32
branches: trunk
changeset: 751242:d959e61d9d32
user: jruoho <jruoho%NetBSD.org@localhost>
date: Fri Jan 29 11:57:37 2010 +0000
description:
Replace all AcpiEvaluateObject() calls with acpi_eval_set_integer().
(As the return buffers are not used for anything, no need to make
unnecessary temporary allocations.)
Compile tested only.
ok jmcneill@
diffstat:
sys/dev/acpi/asus_acpi.c | 56 ++++++++++-------------------------------------
1 files changed, 12 insertions(+), 44 deletions(-)
diffs (116 lines):
diff -r 1b7246e54161 -r d959e61d9d32 sys/dev/acpi/asus_acpi.c
--- a/sys/dev/acpi/asus_acpi.c Fri Jan 29 11:24:31 2010 +0000
+++ b/sys/dev/acpi/asus_acpi.c Fri Jan 29 11:57:37 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: asus_acpi.c,v 1.13 2010/01/29 11:23:25 jruoho Exp $ */
+/* $NetBSD: asus_acpi.c,v 1.14 2010/01/29 11:57:37 jruoho Exp $ */
/*-
* Copyright (c) 2007, 2008, 2009 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: asus_acpi.c,v 1.13 2010/01/29 11:23:25 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: asus_acpi.c,v 1.14 2010/01/29 11:57:37 jruoho Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -242,29 +242,18 @@
asus_init(device_t self)
{
struct asus_softc *sc = device_private(self);
+ ACPI_INTEGER cfv;
ACPI_STATUS rv;
- ACPI_OBJECT param;
- ACPI_OBJECT_LIST params;
- ACPI_BUFFER ret;
- ACPI_INTEGER cfv;
- ret.Pointer = NULL;
- ret.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- param.Type = ACPI_TYPE_INTEGER;
- param.Integer.Value = 0x40; /* disable ASL display switching */
- params.Pointer = ¶m;
- params.Count = 1;
+ /* Disable ASL display switching. */
+ rv = acpi_eval_set_integer(sc->sc_node->ad_handle, "INIT", 0x40);
- rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "INIT",
- ¶ms, &ret);
if (ACPI_FAILURE(rv))
aprint_error_dev(self, "couldn't evaluate INIT: %s\n",
AcpiFormatException(rv));
- if (ret.Pointer)
- ACPI_FREE(ret.Pointer);
+ rv = acpi_eval_integer(sc->sc_node->ad_handle, ASUS_METHOD_CFVG, &cfv);
- rv = acpi_eval_integer(sc->sc_node->ad_handle, ASUS_METHOD_CFVG, &cfv);
if (ACPI_FAILURE(rv))
return;
@@ -292,29 +281,17 @@
{
struct asus_softc *sc = device_private(self);
ACPI_STATUS rv;
- ACPI_OBJECT param;
- ACPI_OBJECT_LIST params;
- ACPI_BUFFER ret;
asus_init(self);
- /* restore previous display brightness */
- ret.Pointer = NULL;
- ret.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- param.Type = ACPI_TYPE_INTEGER;
- param.Integer.Value = sc->sc_brightness;
- params.Pointer = ¶m;
- params.Count = 1;
+ /* Restore previous display brightness. */
+ rv = acpi_eval_set_integer(sc->sc_node->ad_handle, ASUS_METHOD_PBLS,
+ sc->sc_brightness);
- rv = AcpiEvaluateObject(sc->sc_node->ad_handle, ASUS_METHOD_PBLS,
- ¶ms, &ret);
if (ACPI_FAILURE(rv))
aprint_error_dev(self, "couldn't evaluate PBLS: %s\n",
AcpiFormatException(rv));
- if (ret.Pointer != NULL)
- ACPI_FREE(ret);
-
return true;
}
@@ -323,11 +300,8 @@
{
struct sysctlnode node;
struct asus_softc *sc;
+ ACPI_INTEGER cfv;
ACPI_STATUS rv;
- ACPI_INTEGER cfv;
- ACPI_OBJECT param, retval;
- ACPI_OBJECT_LIST params;
- ACPI_BUFFER ret;
int err, tmp;
node = *rnode;
@@ -346,15 +320,9 @@
if (tmp < 0 || tmp >= sc->sc_cfvnum)
return EINVAL;
- ret.Pointer = &retval;
- ret.Length = sizeof(retval);
- param.Type = ACPI_TYPE_INTEGER;
- param.Integer.Value = tmp;
- params.Pointer = ¶m;
- params.Count = 1;
+ rv = acpi_eval_set_integer(sc->sc_node->ad_handle,
+ ASUS_METHOD_CFVS, tmp);
- rv = AcpiEvaluateObject(sc->sc_node->ad_handle,
- ASUS_METHOD_CFVS, ¶ms, &ret);
if (ACPI_FAILURE(rv))
return ENXIO;
}
Home |
Main Index |
Thread Index |
Old Index