summaryrefslogtreecommitdiff
path: root/sys/dev/i2c
diff options
context:
space:
mode:
authorpgoyette <pgoyette@NetBSD.org>2010-07-29 13:07:14 +0000
committerpgoyette <pgoyette@NetBSD.org>2010-07-29 13:07:14 +0000
commit100b434aef0e38e4581658e281fe9d24eaebb8ab (patch)
tree2f299044797cd3d602206565a7235d17649652fc /sys/dev/i2c
parent846cca4cda02ad058d314024d28f72e5fcf30e58 (diff)
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 (limited to 'sys/dev/i2c')
-rw-r--r--sys/dev/i2c/sdtemp.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/sys/dev/i2c/sdtemp.c b/sys/dev/i2c/sdtemp.c
index e8877f41268..5d696a5c05f 100644
--- a/sys/dev/i2c/sdtemp.c
+++ b/sys/dev/i2c/sdtemp.c
@@ -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 @@ sdtemp_refresh(struct sysmon_envsys *sme, envsys_data_t *edata)
/* 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;