Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/acpi Use acpi_eval_struct() to simplify code.
details: https://anonhg.NetBSD.org/src/rev/f3025f0d9618
branches: trunk
changeset: 750541:f3025f0d9618
user: jruoho <jruoho%NetBSD.org@localhost>
date: Tue Jan 05 13:39:49 2010 +0000
description:
Use acpi_eval_struct() to simplify code.
ok pgoyette@, jmcneill@
diffstat:
sys/dev/acpi/acpi.c | 10 ++++------
sys/dev/acpi/acpi_powerres.c | 15 ++++++---------
sys/dev/acpi/dalb_acpi.c | 14 ++++----------
3 files changed, 14 insertions(+), 25 deletions(-)
diffs (123 lines):
diff -r 96ff645c8754 -r f3025f0d9618 sys/dev/acpi/acpi.c
--- a/sys/dev/acpi/acpi.c Tue Jan 05 13:32:49 2010 +0000
+++ b/sys/dev/acpi/acpi.c Tue Jan 05 13:39:49 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi.c,v 1.139 2009/12/31 10:07:13 jruoho Exp $ */
+/* $NetBSD: acpi.c,v 1.140 2010/01/05 13:39:49 jruoho Exp $ */
/*-
* Copyright (c) 2003, 2007 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.139 2009/12/31 10:07:13 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi.c,v 1.140 2010/01/05 13:39:49 jruoho Exp $");
#include "opt_acpi.h"
#include "opt_pcifixup.h"
@@ -966,10 +966,8 @@
aprint_normal("%s (%s) ", aa->aa_node->ad_name,
pnpstr);
- buf.Pointer = NULL;
- buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- rv = AcpiEvaluateObject(aa->aa_node->ad_handle,
- "_STR", NULL, &buf);
+ rv = acpi_eval_struct(aa->aa_node->ad_handle,
+ "_STR", &buf);
if (ACPI_SUCCESS(rv)) {
ACPI_OBJECT *obj = buf.Pointer;
switch (obj->Type) {
diff -r 96ff645c8754 -r f3025f0d9618 sys/dev/acpi/acpi_powerres.c
--- a/sys/dev/acpi/acpi_powerres.c Tue Jan 05 13:32:49 2010 +0000
+++ b/sys/dev/acpi/acpi_powerres.c Tue Jan 05 13:39:49 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: acpi_powerres.c,v 1.7 2009/09/16 10:47:54 mlelstv Exp $ */
+/* $NetBSD: acpi_powerres.c,v 1.8 2010/01/05 13:39:49 jruoho Exp $ */
/*-
* Copyright (c) 2001 Michael Smith
@@ -29,7 +29,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_powerres.c,v 1.7 2009/09/16 10:47:54 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_powerres.c,v 1.8 2010/01/05 13:39:49 jruoho Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@@ -147,8 +147,7 @@
rp->ap_resource = res;
/* get the Power Resource object */
- buf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = AcpiEvaluateObject(res, NULL, NULL, &buf);
+ status = acpi_eval_struct(res, NULL, &buf);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS,
"no power resource object\n"));
@@ -370,8 +369,7 @@
if (ACPI_FAILURE(AcpiGetHandle(consumer, "_PR0", &pr0_handle))) {
goto bad;
}
- reslist_buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = AcpiEvaluateObject(pr0_handle, NULL, NULL, &reslist_buffer);
+ status = acpi_eval_struct(pr0_handle, NULL, &reslist_buffer);
if (ACPI_FAILURE(status))
goto bad;
reslist_object = (ACPI_OBJECT *)reslist_buffer.Pointer;
@@ -388,9 +386,8 @@
* Check that we can actually fetch the list of power resources
*/
if (reslist_handle != NULL) {
- reslist_buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- status = AcpiEvaluateObject(reslist_handle, NULL, NULL,
- &reslist_buffer);
+ status = acpi_eval_struct(reslist_handle,
+ NULL, &reslist_buffer);
if (ACPI_FAILURE(status)) {
ACPI_DEBUG_PRINT((ACPI_DB_OBJECTS, "can't evaluate resource list %s\n",
acpi_name(reslist_handle)));
diff -r 96ff645c8754 -r f3025f0d9618 sys/dev/acpi/dalb_acpi.c
--- a/sys/dev/acpi/dalb_acpi.c Tue Jan 05 13:32:49 2010 +0000
+++ b/sys/dev/acpi/dalb_acpi.c Tue Jan 05 13:39:49 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dalb_acpi.c,v 1.3 2009/09/16 10:47:55 mlelstv Exp $ */
+/* $NetBSD: dalb_acpi.c,v 1.4 2010/01/05 13:39:49 jruoho Exp $ */
/*-
* Copyright (c) 2008 Christoph Egger <cegger%netbsd.org@localhost>
@@ -27,7 +27,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dalb_acpi.c,v 1.3 2009/09/16 10:47:55 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dalb_acpi.c,v 1.4 2010/01/05 13:39:49 jruoho Exp $");
/*
* Direct Application Launch Button:
@@ -124,10 +124,7 @@
ACPI_STATUS rv;
ACPI_BUFFER ret;
- ret.Pointer = NULL;
- ret.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
-
- rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "GHID", NULL, &ret);
+ rv = acpi_eval_struct(sc->sc_node->ad_handle, "GHID", &ret);
if (ACPI_FAILURE(rv) || ret.Pointer == NULL) {
aprint_error_dev(dev,
"couldn't enable notify handler: (%s)\n",
@@ -255,10 +252,7 @@
ACPI_STATUS rv;
ACPI_BUFFER ret;
- ret.Pointer = NULL;
- ret.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
-
- rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "GHID", NULL, &ret);
+ rv = acpi_eval_struct(sc->sc_node->ad_handle, "GHID", &ret);
if (ACPI_FAILURE(rv)) {
aprint_error_dev(dev, "couldn't evaluate GHID: %s\n",
AcpiFormatException(rv));
Home |
Main Index |
Thread Index |
Old Index