Module Name:    src
Committed By:   jruoho
Date:           Mon Mar 22 15:08:36 UTC 2010

Modified Files:
        src/sys/dev/acpi: acpi_bat.c

Log Message:
Fix the previous commit properly: we need to set all sensor-flags during the
initialization of sysmon_envsys(9), otherwise, if _STA does not return true
during the attachment of the driver, it is possible that a flag is never
set. This flaw has always been present, but it only got exposed after the
conversion to use the sysmon-limits.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/dev/acpi/acpi_bat.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/acpi/acpi_bat.c
diff -u src/sys/dev/acpi/acpi_bat.c:1.93 src/sys/dev/acpi/acpi_bat.c:1.94
--- src/sys/dev/acpi/acpi_bat.c:1.93	Mon Mar 22 09:31:24 2010
+++ src/sys/dev/acpi/acpi_bat.c	Mon Mar 22 15:08:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_bat.c,v 1.93 2010/03/22 09:31:24 jruoho Exp $	*/
+/*	$NetBSD: acpi_bat.c,v 1.94 2010/03/22 15:08:35 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.93 2010/03/22 09:31:24 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_bat.c,v 1.94 2010/03/22 15:08:35 jruoho Exp $");
 
 #include <sys/param.h>
 #include <sys/condvar.h>
@@ -418,8 +418,6 @@
 	 */
 	val = sc->sc_sensor[ACPIBAT_LFCCAPACITY].value_cur;
 	sc->sc_sensor[ACPIBAT_CAPACITY].value_max = val;
-	sc->sc_sensor[ACPIBAT_CAPACITY].flags |=
-	    ENVSYS_FPERCENT | ENVSYS_FVALID_MAX;
 
 	acpibat_print_info(dv, elm);
 
@@ -697,7 +695,9 @@
 
 #undef INITDATA
 
-	sc->sc_sensor[ACPIBAT_CAPACITY].flags |= ENVSYS_FMONLIMITS;
+	sc->sc_sensor[ACPIBAT_CAPACITY].flags |=
+	    ENVSYS_FPERCENT | ENVSYS_FVALID_MAX | ENVSYS_FMONLIMITS;
+
 	sc->sc_sensor[ACPIBAT_CHARGE_STATE].flags |= ENVSYS_FMONSTCHANGED;
 
 	/* Disable userland monitoring on these sensors. */

Reply via email to