summaryrefslogtreecommitdiff
path: root/sys/dev/acpi/acpibat.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/acpi/acpibat.c')
-rw-r--r--sys/dev/acpi/acpibat.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/sys/dev/acpi/acpibat.c b/sys/dev/acpi/acpibat.c
index fc8ac6bc03c..ee86f7c8693 100644
--- a/sys/dev/acpi/acpibat.c
+++ b/sys/dev/acpi/acpibat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpibat.c,v 1.50 2008/06/13 05:50:21 jordan Exp $ */
+/* $OpenBSD: acpibat.c,v 1.51 2008/08/05 17:01:06 marco Exp $ */
/*
* Copyright (c) 2005 Marco Peereboom <marco@openbsd.org>
*
@@ -292,9 +292,10 @@ acpibat_getbif(struct acpibat_softc *sc)
struct aml_value res;
int rv = EINVAL;
- memset(&sc->sc_bif, 0, sizeof(sc->sc_bif));
- if (!sc->sc_bat_present)
- return 0;
+ if (!sc->sc_bat_present) {
+ memset(&sc->sc_bif, 0, sizeof(sc->sc_bif));
+ return (0);
+ }
if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BIF", 0, NULL, &res)) {
dnprintf(10, "%s: no _BIF\n", DEVNAME(sc));
@@ -355,9 +356,10 @@ acpibat_getbst(struct acpibat_softc *sc)
struct aml_value res;
int rv = EINVAL;
- memset(&sc->sc_bst, 0, sizeof(sc->sc_bst));
- if (!sc->sc_bat_present)
- return 0;
+ if (!sc->sc_bat_present) {
+ memset(&sc->sc_bst, 0, sizeof(sc->sc_bst));
+ return (0);
+ }
if (aml_evalname(sc->sc_acpi, sc->sc_devnode, "_BST", 0, NULL, &res)) {
dnprintf(10, "%s: no _BST\n", DEVNAME(sc));
@@ -400,7 +402,8 @@ int
acpibat_notify(struct aml_node *node, int notify_type, void *arg)
{
struct acpibat_softc *sc = arg;
- struct aml_value res;
+ struct aml_value res;
+ int present
dnprintf(10, "acpibat_notify: %.2x %s\n", notify_type,
sc->sc_devnode->name);
@@ -408,8 +411,7 @@ acpibat_notify(struct aml_node *node, int notify_type, void *arg)
/* Check if installed state of battery has changed */
memset(&res, 0, sizeof(res));
if (aml_evalname(sc->sc_acpi, node, "_STA", 0, NULL, &res) == 0) {
- int present = (res.v_integer & STA_BATTERY);
-
+ present = res.v_integer & STA_BATTERY;
if (!sc->sc_bat_present && present) {
printf("%s: %s inserted\n", DEVNAME(sc),
sc->sc_devnode->name);