Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c Declare sensor data invalid when reading the sen...



details:   https://anonhg.NetBSD.org/src/rev/872ecc73d3be
branches:  trunk
changeset: 340612:872ecc73d3be
user:      phx <phx%NetBSD.org@localhost>
date:      Fri Sep 18 17:21:43 2015 +0000

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

diffstat:

 sys/dev/i2c/hytp14.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (37 lines):

diff -r 2e7600fb052b -r 872ecc73d3be sys/dev/i2c/hytp14.c
--- a/sys/dev/i2c/hytp14.c      Fri Sep 18 13:40:10 2015 +0000
+++ b/sys/dev/i2c/hytp14.c      Fri Sep 18 17:21:43 2015 +0000
@@ -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 @@
                        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 @@
                        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 @@
                DPRINTF(2, ("%s: %s: failed acquire i2c bus - error %d\n",
                    device_xname(sc->sc_dev), __func__, error));
        }
-       
+
        return sc->sc_valid;
 }
 



Home | Main Index | Thread Index | Old Index