Module Name:    src
Committed By:   pgoyette
Date:           Thu Jul 29 13:07:14 UTC 2010

Modified Files:
        src/sys/dev/i2c: sdtemp.c

Log Message:
When interpreting the alarm bits from the chip, don't report state for
any thresholds which have not been set.  Fixes problem reported by
njoly@ in private E-mail, where chip was initialized with only a Critical
threshold, but was reporting a warning.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/i2c/sdtemp.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/i2c/sdtemp.c
diff -u src/sys/dev/i2c/sdtemp.c:1.17 src/sys/dev/i2c/sdtemp.c:1.18
--- src/sys/dev/i2c/sdtemp.c:1.17	Thu Jul 29 12:01:21 2010
+++ src/sys/dev/i2c/sdtemp.c	Thu Jul 29 13:07:14 2010
@@ -1,4 +1,4 @@
-/*      $NetBSD: sdtemp.c,v 1.17 2010/07/29 12:01:21 njoly Exp $        */
+/*      $NetBSD: sdtemp.c,v 1.18 2010/07/29 13:07:14 pgoyette Exp $        */
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.17 2010/07/29 12:01:21 njoly Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdtemp.c,v 1.18 2010/07/29 13:07:14 pgoyette Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -476,11 +476,14 @@
 	/* Now check for limits */
 	if ((edata->upropset & PROP_DRIVER_LIMITS) == 0)
 		edata->state = ENVSYS_SVALID;
-	else if (val & SDTEMP_ABOVE_CRIT)
+	else if ((val & SDTEMP_ABOVE_CRIT) &&
+		    (edata->upropset & PROP_CRITMAX))
 		edata->state = ENVSYS_SCRITOVER;
-	else if (val & SDTEMP_ABOVE_UPPER)
+	else if ((val & SDTEMP_ABOVE_UPPER) &&
+		    (edata->upropset & PROP_WARNMAX))
 		edata->state = ENVSYS_SWARNOVER;
-	else if (val & SDTEMP_BELOW_LOWER)
+	else if ((val & SDTEMP_BELOW_LOWER) &&
+		    (edata->upropset & PROP_WARNMIN))
 		edata->state = ENVSYS_SWARNUNDER;
 	else
 		edata->state = ENVSYS_SVALID;

Reply via email to