Module Name:    src
Committed By:   phx
Date:           Fri Sep 18 17:21:43 UTC 2015

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

Log Message:
Declare sensor data invalid when reading the sensor failed (device is gone).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/i2c/hytp14.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/hytp14.c
diff -u src/sys/dev/i2c/hytp14.c:1.5 src/sys/dev/i2c/hytp14.c:1.6
--- src/sys/dev/i2c/hytp14.c:1.5	Wed Sep  9 17:16:20 2015
+++ src/sys/dev/i2c/hytp14.c	Fri Sep 18 17:21:43 2015
@@ -37,7 +37,7 @@
  */ 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.5 2015/09/09 17:16:20 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hytp14.c,v 1.6 2015/09/18 17:21:43 phx Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -230,6 +230,7 @@ hytp14_measurement_request(void *aux)
 			DPRINTF(2, ("%s: %s: failed read from 0x%02x - error %d\n",
 			    device_xname(sc->sc_dev), __func__,
 			    sc->sc_addr, error));
+			sc->sc_valid = ENVSYS_SINVALID;
 		} else {
 			DPRINTF(3, ("%s(%s): DF success : "
 			    "0x%02x%02x%02x%02x\n",
@@ -288,6 +289,7 @@ hytp14_refresh_sensor(struct hytp14_sc *
 			DPRINTF(2, ("%s: %s: failed read from 0x%02x - error %d\n",
 			    device_xname(sc->sc_dev), __func__,
 			    sc->sc_addr, error));
+			sc->sc_valid = ENVSYS_SINVALID;
 		} else {
 			DPRINTF(3, ("%s(%s): DF success : "
 			    "0x%02x%02x%02x%02x\n",
@@ -317,7 +319,7 @@ hytp14_refresh_sensor(struct hytp14_sc *
 		DPRINTF(2, ("%s: %s: failed acquire i2c bus - error %d\n",
 		    device_xname(sc->sc_dev), __func__, error));
 	}
-	
+
 	return sc->sc_valid;
 }
 

Reply via email to