Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi Update the limits when a change from absent to ...



details:   https://anonhg.NetBSD.org/src/rev/199ea6821640
branches:  trunk
changeset: 753611:199ea6821640
user:      jruoho <jruoho%NetBSD.org@localhost>
date:      Sat Apr 03 16:29:22 2010 +0000

description:
Update the limits when a change from absent to present is detected.

diffstat:

 sys/dev/acpi/acpi_bat.c |  16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diffs (38 lines):

diff -r 6384704b1c44 -r 199ea6821640 sys/dev/acpi/acpi_bat.c
--- a/sys/dev/acpi/acpi_bat.c   Sat Apr 03 15:48:52 2010 +0000
+++ b/sys/dev/acpi/acpi_bat.c   Sat Apr 03 16:29:22 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: acpi_bat.c,v 1.97 2010/03/26 15:51:55 pooka Exp $      */
+/*     $NetBSD: acpi_bat.c,v 1.98 2010/04/03 16:29:22 jruoho 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.97 2010/03/26 15:51:55 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.98 2010/04/03 16:29:22 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/condvar.h>
@@ -590,9 +590,17 @@
 
        rv = acpibat_get_sta(dv);
 
-       if (rv > 0)
+       if (rv > 0) {
                acpibat_get_info(dv);
-       else {
+
+               /*
+                * If the status changed, update the limits.
+                */
+               if (sc->sc_present == 0 &&
+                   sc->sc_sensor[ACPIBAT_CAPACITY].value_max > 0)
+                       sysmon_envsys_update_limits(sc->sc_sme,
+                           &sc->sc_sensor[ACPIBAT_CAPACITY]);
+       } else {
                i = (rv < 0) ? 0 : ACPIBAT_DVOLTAGE;
 
                while (i < ACPIBAT_COUNT) {



Home | Main Index | Thread Index | Old Index