From 57968d4c6d92c3eea4f0306440a8040f2609e885 Mon Sep 17 00:00:00 2001 From: thorpej Date: Mon, 23 Dec 2019 14:41:41 +0000 Subject: [PATCH] No need to use I2C_F_POLL here. --- 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(-) diff --git a/sys/dev/i2c/lm75.c b/sys/dev/i2c/lm75.c index 08c6883e6c28..d228abf41952 100644 --- a/sys/dev/i2c/lm75.c +++ b/sys/dev/i2c/lm75.c @@ -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 -__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 #include @@ -206,7 +206,7 @@ lmtemp_attach(device_t parent, device_t self, void *aux) 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 @@ lmtemp_attach(device_t parent, device_t self, void *aux) &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 @@ lmtemp_attach(device_t parent, device_t self, void *aux) /* 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 @@ lmtemp_config_write(struct lmtemp_softc *sc, uint8_t val) 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 @@ lmtemp_temp_write(struct lmtemp_softc *sc, uint8_t reg, uint32_t val, int degc) 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 @@ sysctl_lm75_temp(SYSCTLFN_ARGS) 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 --git a/sys/dev/i2c/lm87.c b/sys/dev/i2c/lm87.c index ef6507de4af0..899e9b75cd16 100644 --- a/sys/dev/i2c/lm87.c +++ b/sys/dev/i2c/lm87.c @@ -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 -__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 #include @@ -164,7 +164,7 @@ lmenv_match(device_t parent, cfdata_t match, void *aux) 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 --git a/sys/dev/i2c/mcp980x.c b/sys/dev/i2c/mcp980x.c index b57c15dd2ee5..97107771c2f9 100644 --- a/sys/dev/i2c/mcp980x.c +++ b/sys/dev/i2c/mcp980x.c @@ -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 -__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 #include @@ -143,18 +143,18 @@ mcp980x_reg_read_2(struct mcp980x_softc *sc, uint8_t reg) { 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, ®, - 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 @@ mcp980x_reg_read_1(struct mcp980x_softc *sc, uint8_t reg) { 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, ®, - 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 @@ mcp980x_reg_write_2(struct mcp980x_softc *sc, uint8_t reg, uint16_t val) 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, ®, - 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, ®, - 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 --git a/sys/dev/i2c/mpl115a.c b/sys/dev/i2c/mpl115a.c index f6ddf6e81ca3..a24f3865d258 100644 --- a/sys/dev/i2c/mpl115a.c +++ b/sys/dev/i2c/mpl115a.c @@ -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 -__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 #include @@ -154,16 +154,16 @@ mpl115a_load_coeffs(struct mpl115a_softc *sc) 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, ®, 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 @@ mpl115a_reg_read_1(struct mpl115a_softc *sc, uint8_t reg) { 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 @@ mpl115a_reg_read_1(struct mpl115a_softc *sc, uint8_t reg) 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; }