From 100b434aef0e38e4581658e281fe9d24eaebb8ab Mon Sep 17 00:00:00 2001 From: pgoyette Date: Thu, 29 Jul 2010 13:07:14 +0000 Subject: 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. --- sys/dev/i2c/sdtemp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sys/dev') 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 -__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 #include @@ -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; -- cgit