Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c When interpreting the alarm bits from the chip, ...



details:   https://anonhg.NetBSD.org/src/rev/db5e71091c24
branches:  trunk
changeset: 756705:db5e71091c24
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Thu Jul 29 13:07:14 2010 +0000

description:
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.

diffstat:

 sys/dev/i2c/sdtemp.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (36 lines):

diff -r 1470448dfa05 -r db5e71091c24 sys/dev/i2c/sdtemp.c
--- a/sys/dev/i2c/sdtemp.c      Thu Jul 29 12:56:16 2010 +0000
+++ b/sys/dev/i2c/sdtemp.c      Thu Jul 29 13:07:14 2010 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index