Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/i2c No need to use I2C_F_POLL here.



details:   https://anonhg.NetBSD.org/src/rev/e7d121584d65
branches:  trunk
changeset: 1005851:e7d121584d65
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Dec 23 14:41:41 2019 +0000

description:
No need to use I2C_F_POLL here.

diffstat:

 sys/dev/i2c/lm75.c    |  26 +++++++++++++-------------
 sys/dev/i2c/lm87.c    |   6 +++---
 sys/dev/i2c/mcp980x.c |  32 ++++++++++++++++----------------
 sys/dev/i2c/mpl115a.c |  18 +++++++++---------
 4 files changed, 41 insertions(+), 41 deletions(-)

diffs (truncated from 301 to 300 lines):

diff -r 2cb89b3a7dc8 -r e7d121584d65 sys/dev/i2c/lm75.c
--- a/sys/dev/i2c/lm75.c        Mon Dec 23 14:34:23 2019 +0000
+++ b/sys/dev/i2c/lm75.c        Mon Dec 23 14:41:41 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lm75.c,v 1.34 2019/02/20 18:19:46 macallan Exp $       */
+/*     $NetBSD: lm75.c,v 1.35 2019/12/23 14:41:41 thorpej Exp $        */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.34 2019/02/20 18:19:46 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.35 2019/12/23 14:41:41 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -206,7 +206,7 @@
        sc->sc_lmtemp_decode = lmtemptbl[i].lmtemp_decode;
        sc->sc_lmtemp_encode = lmtemptbl[i].lmtemp_encode;
 
-       iic_acquire_bus(sc->sc_tag, I2C_F_POLL);
+       iic_acquire_bus(sc->sc_tag, 0);
 
        /* Read temperature limit(s) and remember initial value(s). */
        if (i == lmtemp_lm77) {
@@ -214,28 +214,28 @@
                    &sc->sc_scrit, 1) != 0) {
                        aprint_error_dev(self,
                            "unable to read low register\n");
-                       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+                       iic_release_bus(sc->sc_tag, 0);
                        return;
                }
                if (lmtemp_temp_read(sc, LM77_REG_TLOW_SET_POINT,
                    &sc->sc_smin, 1) != 0) {
                        aprint_error_dev(self,
                            "unable to read low register\n");
-                       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+                       iic_release_bus(sc->sc_tag, 0);
                        return;
                }
                if (lmtemp_temp_read(sc, LM77_REG_THIGH_SET_POINT,
                    &sc->sc_smax, 1) != 0) {
                        aprint_error_dev(self,
                            "unable to read high register\n");
-                       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+                       iic_release_bus(sc->sc_tag, 0);
                        return;
                }
        } else {        /* LM75 or compatible */
                if (lmtemp_temp_read(sc, LM75_REG_TOS_SET_POINT,
                    &sc->sc_smax, 1) != 0) {
                        aprint_error_dev(self, "unable to read Tos register\n");
-                       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+                       iic_release_bus(sc->sc_tag, 0);
                        return;
                }
        }
@@ -247,10 +247,10 @@
        /* Set the configuration of the LM75 to defaults. */
        if (lmtemp_config_write(sc, LM75_CONFIG_FAULT_QUEUE_4) != 0) {
                aprint_error_dev(self, "unable to write config register\n");
-               iic_release_bus(sc->sc_tag, I2C_F_POLL);
+               iic_release_bus(sc->sc_tag, 0);
                return;
        }
-       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+       iic_release_bus(sc->sc_tag, 0);
 
        sc->sc_sme = sysmon_envsys_create();
        /* Initialize sensor data. */
@@ -297,7 +297,7 @@
        cmdbuf[1] = val;
 
        return iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
-           sc->sc_address, cmdbuf, 1, &cmdbuf[1], 1, I2C_F_POLL);
+           sc->sc_address, cmdbuf, 1, &cmdbuf[1], 1, 0);
 }
 
 static int
@@ -309,7 +309,7 @@
        sc->sc_lmtemp_encode(val, &cmdbuf[1], degc);
 
        return iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP,
-           sc->sc_address, cmdbuf, 1, &cmdbuf[1], 2, I2C_F_POLL);
+           sc->sc_address, cmdbuf, 1, &cmdbuf[1], 2, 0);
 }
 
 static int
@@ -596,12 +596,12 @@
 
                        temp = *(int *)node.sysctl_data;
                        sc->sc_tmax = temp;
-                       iic_acquire_bus(sc->sc_tag, I2C_F_POLL);
+                       iic_acquire_bus(sc->sc_tag, 0);
                        lmtemp_temp_write(sc, LM75_REG_THYST_SET_POINT,
                            sc->sc_tmax - 5, 1);
                        lmtemp_temp_write(sc, LM75_REG_TOS_SET_POINT,
                            sc->sc_tmax, 1);
-                       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+                       iic_release_bus(sc->sc_tag, 0);
 
                        /* Synchronise envsys - calls lmtemp_getlim_lm75() */
                        sysmon_envsys_update_limits(sc->sc_sme, &sc->sc_sensor);
diff -r 2cb89b3a7dc8 -r e7d121584d65 sys/dev/i2c/lm87.c
--- a/sys/dev/i2c/lm87.c        Mon Dec 23 14:34:23 2019 +0000
+++ b/sys/dev/i2c/lm87.c        Mon Dec 23 14:41:41 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lm87.c,v 1.10 2018/06/26 06:03:57 thorpej Exp $        */
+/*     $NetBSD: lm87.c,v 1.11 2019/12/23 14:43:03 thorpej Exp $        */
 /*     $OpenBSD: lm87.c,v 1.20 2008/11/10 05:19:48 cnst Exp $  */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: lm87.c,v 1.10 2018/06/26 06:03:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lm87.c,v 1.11 2019/12/23 14:43:03 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -164,7 +164,7 @@
        cmd = LM87_COMPANY_ID;
        iic_acquire_bus(ia->ia_tag, 0);
        error = iic_exec(ia->ia_tag, I2C_OP_READ_WITH_STOP, ia->ia_addr,
-           &cmd, 1, &val, 1, I2C_F_POLL);
+           &cmd, 1, &val, 1, 0);
        iic_release_bus(ia->ia_tag, 0);
 
        if (error)
diff -r 2cb89b3a7dc8 -r e7d121584d65 sys/dev/i2c/mcp980x.c
--- a/sys/dev/i2c/mcp980x.c     Mon Dec 23 14:34:23 2019 +0000
+++ b/sys/dev/i2c/mcp980x.c     Mon Dec 23 14:41:41 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mcp980x.c,v 1.6 2018/06/16 21:22:13 thorpej Exp $ */
+/*     $NetBSD: mcp980x.c,v 1.7 2019/12/23 14:48:58 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mcp980x.c,v 1.6 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcp980x.c,v 1.7 2019/12/23 14:48:58 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -143,18 +143,18 @@
 {
        uint16_t rv;
 
-       if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+       if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
                aprint_error_dev(sc->sc_dev, "cannot acquire bus for read\n");
                return 0;
        }
 
        if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, &reg,
-           1, &rv, 2, I2C_F_POLL)) {
+           1, &rv, 2, 0)) {
+               iic_release_bus(sc->sc_tag, 0);
                aprint_error_dev(sc->sc_dev, "cannot execute operation\n");
-               iic_release_bus(sc->sc_tag, I2C_F_POLL);
                return 0;
        }
-       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+       iic_release_bus(sc->sc_tag, 0);
 
        return be16toh(rv);
 }
@@ -164,18 +164,18 @@
 {
        uint8_t rv;
 
-       if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+       if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
                aprint_error_dev(sc->sc_dev, "cannot acquire bus for read\n");
                return 0;
        }
 
        if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, &reg,
-           1, &rv, 1, I2C_F_POLL)) {
+           1, &rv, 1, 0)) {
+               iic_release_bus(sc->sc_tag, 0);
                aprint_error_dev(sc->sc_dev, "cannot execute operation\n");
-               iic_release_bus(sc->sc_tag, I2C_F_POLL);
                return 0;
        }
-       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+       iic_release_bus(sc->sc_tag, 0);
 
        return rv;
 }
@@ -187,34 +187,34 @@
 
        beval = htobe16(val);
 
-        if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+        if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
                aprint_error_dev(sc->sc_dev, "cannot acquire bus for write\n");
                return;
        }
 
         if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, &reg,
-           1, &beval, 2, I2C_F_POLL)) {
+           1, &beval, 2, 0)) {
                aprint_error_dev(sc->sc_dev, "cannot execute operation\n");
         }
 
-       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+       iic_release_bus(sc->sc_tag, 0);
 
 }
 
 static void
 mcp980x_reg_write_1(struct mcp980x_softc *sc, uint8_t reg, uint8_t val)
 {
-        if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+        if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
                aprint_error_dev(sc->sc_dev, "cannot acquire bus for write\n");
                return;
        }
 
         if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, &reg,
-           1, &val, 1, I2C_F_POLL)) {
+           1, &val, 1, 0)) {
                aprint_error_dev(sc->sc_dev, "cannot execute operation\n");
         }
 
-       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+       iic_release_bus(sc->sc_tag, 0);
 
 }
 
diff -r 2cb89b3a7dc8 -r e7d121584d65 sys/dev/i2c/mpl115a.c
--- a/sys/dev/i2c/mpl115a.c     Mon Dec 23 14:34:23 2019 +0000
+++ b/sys/dev/i2c/mpl115a.c     Mon Dec 23 14:41:41 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mpl115a.c,v 1.2 2018/06/16 21:22:13 thorpej Exp $ */
+/*     $NetBSD: mpl115a.c,v 1.3 2019/12/23 14:50:43 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mpl115a.c,v 1.2 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mpl115a.c,v 1.3 2019/12/23 14:50:43 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -154,16 +154,16 @@
 static void 
 mpl115a_reg_write_1(struct mpl115a_softc *sc, uint8_t reg, uint8_t val) 
 {
-       if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+       if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
                aprint_error_dev(sc->sc_dev, "cannot acquire bus for write\n");
                return;
        }
 
        if (iic_exec(sc->sc_tag, I2C_OP_WRITE_WITH_STOP, sc->sc_addr, &reg, 1,
-           &val, 1, I2C_F_POLL)) {
+           &val, 1, 0)) {
                aprint_error_dev(sc->sc_dev, "cannot execute write\n");
        }
-       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+       iic_release_bus(sc->sc_tag, 0);
 }
 
 static uint8_t
@@ -171,7 +171,7 @@
 {
        uint8_t rv, wbuf[2];
 
-       if (iic_acquire_bus(sc->sc_tag, I2C_F_POLL) != 0) {
+       if (iic_acquire_bus(sc->sc_tag, 0) != 0) {
 #ifdef MPL115A_DEBUG
                aprint_error_dev(sc->sc_dev, "cannot acquire bus for read\n");
 #endif /* MPL115A_DEBUG */ 
@@ -181,12 +181,12 @@
        wbuf[0] = reg;
 
        if (iic_exec(sc->sc_tag, I2C_OP_READ_WITH_STOP, sc->sc_addr, wbuf,
-           1, &rv, 1, I2C_F_POLL)) {
+           1, &rv, 1, 0)) {
+               iic_release_bus(sc->sc_tag, 0);
                aprint_error_dev(sc->sc_dev, "cannot execute read\n");
-               iic_release_bus(sc->sc_tag, I2C_F_POLL);
                return 0;
        }
-       iic_release_bus(sc->sc_tag, I2C_F_POLL);
+       iic_release_bus(sc->sc_tag, 0);
 
        return rv;



Home | Main Index | Thread Index | Old Index