Clean up some messages:

* Use AcpiFormatException() in a bunch of places.
* acpi_resource_parse() already prints an error, so don't do it in the callers.
This commit is contained in:
mycroft 2003-11-03 17:54:39 +00:00
parent 01558f7ee2
commit b910c03a32
4 changed files with 61 additions and 66 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: acpi_wakeup.c,v 1.8 2003/10/28 04:59:18 junyoung Exp $ */ /* $NetBSD: acpi_wakeup.c,v 1.9 2003/11/03 17:54:39 mycroft Exp $ */
/*- /*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. * Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.8 2003/10/28 04:59:18 junyoung Exp $"); __KERNEL_RCSID(0, "$NetBSD: acpi_wakeup.c,v 1.9 2003/11/03 17:54:39 mycroft Exp $");
/*- /*-
* Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org> * Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
@ -350,7 +350,7 @@ acpi_md_sleep(int state)
} }
if (status != AE_OK) { if (status != AE_OK) {
printf("acpi: AcpiEnterSleepState failed - %s\n", printf("acpi: AcpiEnterSleepState failed: %s\n",
AcpiFormatException(status)); AcpiFormatException(status));
ret = -1; ret = -1;
goto out; goto out;

View File

@ -1,4 +1,4 @@
/* $NetBSD: npx_acpi.c,v 1.3 2003/11/03 06:03:47 kochi Exp $ */ /* $NetBSD: npx_acpi.c,v 1.4 2003/11/03 17:54:39 mycroft Exp $ */
/* /*
* Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca> * Copyright (c) 2002 Jared D. McNeill <jmcneill@invisible.ca>
@ -26,7 +26,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: npx_acpi.c,v 1.3 2003/11/03 06:03:47 kochi Exp $"); __KERNEL_RCSID(0, "$NetBSD: npx_acpi.c,v 1.4 2003/11/03 17:54:39 mycroft Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -93,10 +93,8 @@ npx_acpi_attach(struct device *parent, struct device *self, void *aux)
/* parse resources */ /* parse resources */
rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node, &res, rv = acpi_resource_parse(&sc->sc_dev, aa->aa_node, &res,
&acpi_resource_parse_ops_default); &acpi_resource_parse_ops_default);
if (rv != AE_OK) { if (rv != AE_OK)
printf("%s: unable to parse resources\n", sc->sc_dev.dv_xname);
return; return;
}
/* find our i/o registers */ /* find our i/o registers */
io = acpi_res_io(&res, 0); io = acpi_res_io(&res, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: spic_acpi.c,v 1.7 2003/11/03 06:03:47 kochi Exp $ */ /* $NetBSD: spic_acpi.c,v 1.8 2003/11/03 17:54:39 mycroft Exp $ */
/* /*
* Copyright (c) 2002 The NetBSD Foundation, Inc. * Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -37,7 +37,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.7 2003/11/03 06:03:47 kochi Exp $"); __KERNEL_RCSID(0, "$NetBSD: spic_acpi.c,v 1.8 2003/11/03 17:54:39 mycroft Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -102,11 +102,8 @@ spic_acpi_attach(struct device *parent, struct device *self, void *aux)
/* Parse our resources. */ /* Parse our resources. */
rv = acpi_resource_parse(&sc->sc_spic.sc_dev, sc->sc_node, &sc->sc_res, rv = acpi_resource_parse(&sc->sc_spic.sc_dev, sc->sc_node, &sc->sc_res,
&acpi_resource_parse_ops_default); &acpi_resource_parse_ops_default);
if (rv != AE_OK) { if (rv != AE_OK)
printf("%s: unable to parse resources: %d\n",
sc->sc_spic.sc_dev.dv_xname, rv);
return; return;
}
sc->sc_spic.sc_iot = aa->aa_iot; sc->sc_spic.sc_iot = aa->aa_iot;
io = acpi_res_io(&sc->sc_res, 0); io = acpi_res_io(&sc->sc_res, 0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: vald_acpi.c,v 1.15 2003/11/03 06:03:47 kochi Exp $ */ /* $NetBSD: vald_acpi.c,v 1.16 2003/11/03 17:54:39 mycroft Exp $ */
/*- /*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. * Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -83,7 +83,7 @@
*/ */
#include <sys/cdefs.h> #include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: vald_acpi.c,v 1.15 2003/11/03 06:03:47 kochi Exp $"); __KERNEL_RCSID(0, "$NetBSD: vald_acpi.c,v 1.16 2003/11/03 17:54:39 mycroft Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <sys/systm.h> #include <sys/systm.h>
@ -202,37 +202,33 @@ vald_acpi_attach(struct device *parent, struct device *self, void *aux)
rv = acpi_eval_integer(ACPI_ROOT_OBJECT, rv = acpi_eval_integer(ACPI_ROOT_OBJECT,
"\\_SB_.ADP1._PSR",&sc->sc_ac_status); "\\_SB_.ADP1._PSR",&sc->sc_ac_status);
if (rv != AE_OK) if (rv != AE_OK)
printf("%s: Unable to evaluate _PSR error %x\n", printf("%s: Unable to evaluate _PSR: %s\n",
sc->sc_dev.dv_xname, rv); sc->sc_dev.dv_xname, AcpiFormatException(rv));
else else
printf("AC adaptor status %sconnected\n", printf("AC adaptor status %sconnected\n",
(sc->sc_ac_status == 0 ? "not ": "")); (sc->sc_ac_status == 0 ? "not ": ""));
/* Get LCD backlight status. */ /* Get LCD backlight status. */
rv = vald_acpi_ghci_get(sc, GHCI_BACKLIGHT, &value, &result); rv = vald_acpi_ghci_get(sc, GHCI_BACKLIGHT, &value, &result);
if (rv != AE_OK) if (rv == AE_OK) {
printf("%s: Unable to evaluate GHCI\n", sc->sc_dev.dv_xname);
if (result != 0) if (result != 0)
printf("%s: Can't get status of LCD backlight error=%x\n", printf("%s: can't get backlight status error=%d\n",
sc->sc_dev.dv_xname, result); sc->sc_dev.dv_xname, result);
else else
printf("LCD backlight status %s\n", printf("LCD backlight status %s\n",
((value == GHCI_ON) ? "on" : "off")); ((value == GHCI_ON) ? "on" : "off"));
}
/* Enable SystemEventFIFO,HotkeyEvent */ /* Enable SystemEventFIFO,HotkeyEvent */
rv = vald_acpi_ghci_set(sc, GHCI_SYSTEM_EVENT_FIFO, GHCI_ENABLE, rv = vald_acpi_ghci_set(sc, GHCI_SYSTEM_EVENT_FIFO, GHCI_ENABLE,
&result); &result);
if (rv != AE_OK) if (rv == AE_OK && result != 0)
printf("%s: unable to evaluate GHCI\n", sc->sc_dev.dv_xname); printf("%s: can't enable SystemEventFIFO error=%d\n",
if (result != 0)
printf("%s: Can't enable SystemEventFIFO error=%d\n",
sc->sc_dev.dv_xname, result); sc->sc_dev.dv_xname, result);
rv = vald_acpi_ghci_set(sc, GHCI_HOTKEY_EVENT, GHCI_ENABLE, &result); rv = vald_acpi_ghci_set(sc, GHCI_HOTKEY_EVENT, GHCI_ENABLE, &result);
if (rv != AE_OK) if (rv == AE_OK && result != 0)
printf("%s: unable to evaluate GHCI\n", sc->sc_dev.dv_xname); printf("%s: can't enable HotkeyEvent error=%d\n",
if (result != 0)
printf("%s: Can't enable HotkeyEvent error=%d\n",
sc->sc_dev.dv_xname, result); sc->sc_dev.dv_xname, result);
/* Check SystemFIFO events. */ /* Check SystemFIFO events. */
@ -249,8 +245,8 @@ vald_acpi_attach(struct device *parent, struct device *self, void *aux)
rv = AcpiInstallNotifyHandler(sc->sc_node->ad_handle, rv = AcpiInstallNotifyHandler(sc->sc_node->ad_handle,
ACPI_DEVICE_NOTIFY, vald_acpi_notify_handler, sc); ACPI_DEVICE_NOTIFY, vald_acpi_notify_handler, sc);
if (rv != AE_OK) if (rv != AE_OK)
printf("%s: Can't install notify handler (%04x)\n", printf("%s: can't install DEVICE NOTIFY handler: %s\n",
sc->sc_dev.dv_xname, (uint)rv); sc->sc_dev.dv_xname, AcpiFormatException(rv));
} }
/* /*
@ -276,12 +272,13 @@ vald_acpi_notify_handler(ACPI_HANDLE handle, UINT32 notify, void *context)
if (ACPI_FAILURE(rv)) if (ACPI_FAILURE(rv))
printf("%s: WARNING: unable to queue vald change " printf("%s: WARNING: unable to queue vald change "
"event: %04x\n", sc->sc_dev.dv_xname, (uint)rv); "event: %s\n", sc->sc_dev.dv_xname,
AcpiFormatException(rv));
break; break;
default: default:
printf("vald_acpi_notify_handler: unknown event: %04" printf("%s: received unknown notify messages: 0x%x\n",
PRIu32 "\n", notify); sc->sc_dev.dv_xname, notify);
break; break;
} }
} }
@ -364,8 +361,8 @@ vald_acpi_ghci_get(struct vald_acpi_softc *sc,
rv = AcpiEvaluateObject(sc->sc_node->ad_handle, rv = AcpiEvaluateObject(sc->sc_node->ad_handle,
"GHCI", &ArgList, &buf); "GHCI", &ArgList, &buf);
if (rv != AE_OK) { if (rv != AE_OK) {
printf("%s: failed to evaluate GHCI: 0x%x\n", printf("%s: failed to evaluate GHCI: %s\n",
sc->sc_dev.dv_xname, rv); sc->sc_dev.dv_xname, AcpiFormatException(rv));
return (rv); return (rv);
} }
@ -422,10 +419,11 @@ vald_acpi_ghci_set(struct vald_acpi_softc *sc,
rv = AcpiEvaluateObject(sc->sc_node->ad_handle, rv = AcpiEvaluateObject(sc->sc_node->ad_handle,
"GHCI", &ArgList, &buf); "GHCI", &ArgList, &buf);
if (rv != AE_OK) { if (rv != AE_OK) {
printf("%s: failed to evaluate GHCI: 0x%x\n", printf("%s: failed to evaluate GHCI: %s\n",
sc->sc_dev.dv_xname, rv); sc->sc_dev.dv_xname, AcpiFormatException(rv));
return (rv); return (rv);
} }
*result = GHCI_NOT_SUPPORT; *result = GHCI_NOT_SUPPORT;
param = (ACPI_OBJECT *)buf.Pointer; param = (ACPI_OBJECT *)buf.Pointer;
if (param->Type == ACPI_TYPE_PACKAGE) { if (param->Type == ACPI_TYPE_PACKAGE) {
@ -507,7 +505,7 @@ vald_acpi_libright_get(struct vald_acpi_softc *sc)
{ {
ACPI_HANDLE parent; ACPI_HANDLE parent;
printf("%s: Get LCD brightness via _BCL\n", sc->sc_dev.dv_xname); printf("%s: get LCD brightness via _BCL\n", sc->sc_dev.dv_xname);
#ifdef ACPI_DEBUG #ifdef ACPI_DEBUG
printf("acpi_libright_get: start\n"); printf("acpi_libright_get: start\n");
@ -537,11 +535,8 @@ vald_acpi_libright_set(struct vald_acpi_softc *sc, int UpDown)
/* Get LCD backlight status. */ /* Get LCD backlight status. */
rv = vald_acpi_ghci_get(sc, GHCI_BACKLIGHT, &backlight, &result); rv = vald_acpi_ghci_get(sc, GHCI_BACKLIGHT, &backlight, &result);
if (rv != AE_OK) if (rv != AE_OK || result != 0)
printf("%s: unable to evaluate GHCI\n", sc->sc_dev.dv_xname); return;
if (result != 0)
printf("%s: Can't get LCD backlight status error=%x\n",
sc->sc_dev.dv_xname, result);
/* Figure up next status. */ /* Figure up next status. */
backlight_new = backlight; backlight_new = backlight;
@ -573,11 +568,8 @@ vald_acpi_libright_set(struct vald_acpi_softc *sc, int UpDown)
if (backlight_new != backlight) { if (backlight_new != backlight) {
rv = vald_acpi_ghci_set(sc, GHCI_BACKLIGHT, backlight_new, rv = vald_acpi_ghci_set(sc, GHCI_BACKLIGHT, backlight_new,
&result); &result);
if (rv != AE_OK) if (rv == AE_OK && result != 0)
printf("%s: unable to evaluate GHCI\n", printf("%s: can't set LCD backlight %s error=%x\n",
sc->sc_dev.dv_xname);
if (result != 0)
printf("%s: Can't set LCD backlight %s error=%x\n",
sc->sc_dev.dv_xname, sc->sc_dev.dv_xname,
((backlight_new == 1) ? "on" : "off"), result); ((backlight_new == 1) ? "on" : "off"), result);
} }
@ -589,7 +581,8 @@ vald_acpi_libright_set(struct vald_acpi_softc *sc, int UpDown)
rv = vald_acpi_bcm_set(sc->lcd_handle, bright); rv = vald_acpi_bcm_set(sc->lcd_handle, bright);
if (rv != AE_OK) if (rv != AE_OK)
printf("Unable to evaluate _BCM: %d\n", rv); printf("%s: unable to evaluate _BCM: %s\n",
sc->sc_dev.dv_xname, AcpiFormatException(rv));
} else { } else {
bright = 0; bright = 0;
} }
@ -615,10 +608,12 @@ vald_acpi_video_switch(struct vald_acpi_softc *sc)
/* Get video status. */ /* Get video status. */
rv = vald_acpi_ghci_get(sc, GHCI_DISPLAY_DEVICE, &value, &result); rv = vald_acpi_ghci_get(sc, GHCI_DISPLAY_DEVICE, &value, &result);
if (rv != AE_OK) if (rv != AE_OK)
printf("%s: unable to evaluate GHCI\n", sc->sc_dev.dv_xname); return;
if (result != 0) if (result != 0) {
printf("%s: Can't get video status error=%x\n", printf("%s: can't get video status error=%x\n",
sc->sc_dev.dv_xname, result); sc->sc_dev.dv_xname, result);
return;
}
#ifdef ACPI_DEBUG #ifdef ACPI_DEBUG
printf("Toggle LCD/CRT\n"); printf("Toggle LCD/CRT\n");
@ -638,7 +633,8 @@ vald_acpi_video_switch(struct vald_acpi_softc *sc)
rv = vald_acpi_dssx_set(value); rv = vald_acpi_dssx_set(value);
if (rv != AE_OK) if (rv != AE_OK)
printf("Unable to evaluate DSSX: %d\n", rv); printf("%s: unable to evaluate DSSX: %s\n",
sc->sc_dev.dv_xname, AcpiFormatException(rv));
} }
@ -702,10 +698,12 @@ vald_acpi_fan_switch(struct vald_acpi_softc *sc)
/* Get FAN status */ /* Get FAN status */
rv = vald_acpi_ghci_get(sc, GHCI_FAN, &value, &result); rv = vald_acpi_ghci_get(sc, GHCI_FAN, &value, &result);
if (rv != AE_OK) if (rv != AE_OK)
printf("%s: unable to evaluate GHCI\n", sc->sc_dev.dv_xname); return;
if (result != 0) if (result != 0) {
printf("%s: Can't get FAN status error=%d\n", printf("%s: can't get FAN status error=%d\n",
sc->sc_dev.dv_xname, result); sc->sc_dev.dv_xname, result);
return;
}
#ifdef ACPI_DEBUG #ifdef ACPI_DEBUG
printf("Toggle FAN on/off\n"); printf("Toggle FAN on/off\n");
@ -722,10 +720,12 @@ vald_acpi_fan_switch(struct vald_acpi_softc *sc)
/* Set FAN new status. */ /* Set FAN new status. */
rv = vald_acpi_ghci_set(sc, GHCI_FAN, value, &result); rv = vald_acpi_ghci_set(sc, GHCI_FAN, value, &result);
if (rv != AE_OK) if (rv != AE_OK)
printf("%s: unable to evaluate GHCI\n", sc->sc_dev.dv_xname); return;
if (result != 0) if (result != 0) {
printf("%s: Can't set FAN status error=%d\n", printf("%s: can't set FAN status error=%d\n",
sc->sc_dev.dv_xname, result); sc->sc_dev.dv_xname, result);
return;
}
#ifdef ACPI_DEBUG #ifdef ACPI_DEBUG
printf("\t After toggle, FAN status %s\n", printf("\t After toggle, FAN status %s\n",