Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/acpi the "Battery Present Rate" is only required to ...



details:   https://anonhg.NetBSD.org/src/rev/3b79c3eb496b
branches:  trunk
changeset: 751202:3b79c3eb496b
user:      drochner <drochner%NetBSD.org@localhost>
date:      Wed Jan 27 22:17:28 2010 +0000

description:
the "Battery Present Rate" is only required to be valid if the battery
is discharging; it might make sense when charging, but it doesn't
make sense if neither is the case -- remove a wrong assertion and
arrange the code to make this obvious
(actually, the ACPI spec says that the requirement is only for
rechargeable batteries)

diffstat:

 sys/dev/acpi/acpi_bat.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (42 lines):

diff -r 7bea78153625 -r 3b79c3eb496b sys/dev/acpi/acpi_bat.c
--- a/sys/dev/acpi/acpi_bat.c   Wed Jan 27 22:03:11 2010 +0000
+++ b/sys/dev/acpi/acpi_bat.c   Wed Jan 27 22:17:28 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_bat.c,v 1.78 2010/01/24 11:32:13 jruoho Exp $     */
+/*     $NetBSD: acpi_bat.c,v 1.79 2010/01/27 22:17:28 drochner Exp $   */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.78 2010/01/24 11:32:13 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.79 2010/01/27 22:17:28 drochner Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -462,20 +462,20 @@
                        rv = AE_TYPE;
                        goto out;
                }
-
-               KDASSERT((uint64_t)elm[i].Integer.Value < INT_MAX);
        }
 
-       rate = elm[ACPIBAT_BST_RATE].Integer.Value;
        state = elm[ACPIBAT_BST_STATE].Integer.Value;
 
        if ((state & ACPIBAT_ST_CHARGING) != 0) {
+               /* XXX rate can be invalid */
+               rate = elm[ACPIBAT_BST_RATE].Integer.Value;
                sc->sc_sensor[ACPIBAT_CHARGERATE].state = ENVSYS_SVALID;
                sc->sc_sensor[ACPIBAT_CHARGERATE].value_cur = rate * 1000;
                sc->sc_sensor[ACPIBAT_DISCHARGERATE].state = ENVSYS_SINVALID;
                sc->sc_sensor[ACPIBAT_CHARGING].state = ENVSYS_SVALID;
                sc->sc_sensor[ACPIBAT_CHARGING].value_cur = 1;
        } else if ((state & ACPIBAT_ST_DISCHARGING) != 0) {
+               rate = elm[ACPIBAT_BST_RATE].Integer.Value;
                sc->sc_sensor[ACPIBAT_DISCHARGERATE].state = ENVSYS_SVALID;
                sc->sc_sensor[ACPIBAT_DISCHARGERATE].value_cur = rate * 1000;
                sc->sc_sensor[ACPIBAT_CHARGERATE].state = ENVSYS_SINVALID;



Home | Main Index | Thread Index | Old Index