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 check cold to add I2C_F_POLL; the i2c...



details:   https://anonhg.NetBSD.org/src/rev/185b1e010188
branches:  trunk
changeset: 962655:185b1e010188
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sat Jul 27 16:02:27 2019 +0000

description:
No need to check cold to add I2C_F_POLL; the i2c API does it for us now.

diffstat:

 sys/dev/i2c/ac100.c   |  10 ++++------
 sys/dev/i2c/act8846.c |  10 ++++------
 sys/dev/i2c/as3722.c  |  28 ++++++++++++++--------------
 sys/dev/i2c/axp809.c  |  10 ++++------
 sys/dev/i2c/axppmic.c |  10 +++++-----
 sys/dev/i2c/em3027.c  |   6 +++---
 6 files changed, 34 insertions(+), 40 deletions(-)

diffs (truncated from 306 to 300 lines):

diff -r 0ab634321857 -r 185b1e010188 sys/dev/i2c/ac100.c
--- a/sys/dev/i2c/ac100.c       Sat Jul 27 16:00:02 2019 +0000
+++ b/sys/dev/i2c/ac100.c       Sat Jul 27 16:02:27 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ac100.c,v 1.3 2019/05/27 21:11:13 jmcneill Exp $ */
+/* $NetBSD: ac100.c,v 1.4 2019/07/27 16:02:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_fdt.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ac100.c,v 1.3 2019/05/27 21:11:13 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ac100.c,v 1.4 2019/07/27 16:02:27 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -165,15 +165,13 @@
 static int
 ac100_read(struct ac100_softc *sc, uint8_t reg, uint16_t *val)
 {
-       return iic_smbus_read_word(sc->sc_i2c, sc->sc_addr, reg, val,
-           cold ? I2C_F_POLL : 0);
+       return iic_smbus_read_word(sc->sc_i2c, sc->sc_addr, reg, val, 0);
 }
 
 static int
 ac100_write(struct ac100_softc *sc, uint8_t reg, uint16_t val)
 {
-       return iic_smbus_write_word(sc->sc_i2c, sc->sc_addr, reg, val,
-           cold ? I2C_F_POLL : 0);
+       return iic_smbus_write_word(sc->sc_i2c, sc->sc_addr, reg, val, 0);
 }
 
 static int
diff -r 0ab634321857 -r 185b1e010188 sys/dev/i2c/act8846.c
--- a/sys/dev/i2c/act8846.c     Sat Jul 27 16:00:02 2019 +0000
+++ b/sys/dev/i2c/act8846.c     Sat Jul 27 16:02:27 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: act8846.c,v 1.5 2018/06/16 21:22:13 thorpej Exp $ */
+/* $NetBSD: act8846.c,v 1.6 2019/07/27 16:02:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 //#define ACT_DEBUG
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: act8846.c,v 1.5 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: act8846.c,v 1.6 2019/07/27 16:02:27 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -185,15 +185,13 @@
 static int
 act8846_read(struct act8846_softc *sc, uint8_t reg, uint8_t *val)
 {
-       return iic_smbus_read_byte(sc->sc_i2c, sc->sc_addr, reg, val,
-           cold ? I2C_F_POLL : 0);
+       return iic_smbus_read_byte(sc->sc_i2c, sc->sc_addr, reg, val, 0);
 }
 
 static int
 act8846_write(struct act8846_softc *sc, uint8_t reg, uint8_t val)
 {
-       return iic_smbus_write_byte(sc->sc_i2c, sc->sc_addr, reg, val,
-           cold ? I2C_F_POLL : 0);
+       return iic_smbus_write_byte(sc->sc_i2c, sc->sc_addr, reg, val, 0);
 }
 
 static void
diff -r 0ab634321857 -r 185b1e010188 sys/dev/i2c/as3722.c
--- a/sys/dev/i2c/as3722.c      Sat Jul 27 16:00:02 2019 +0000
+++ b/sys/dev/i2c/as3722.c      Sat Jul 27 16:02:27 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: as3722.c,v 1.15 2018/06/26 06:03:57 thorpej Exp $ */
+/* $NetBSD: as3722.c,v 1.16 2019/07/27 16:02:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "opt_fdt.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: as3722.c,v 1.15 2018/06/26 06:03:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: as3722.c,v 1.16 2019/07/27 16:02:27 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -372,7 +372,7 @@
        struct as3722_softc * const sc = smw->smw_cookie;
        int error;
 
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
 
        if ((smw->smw_mode & WDOG_MODE_MASK) == WDOG_MODE_DISARMED) {
                iic_acquire_bus(sc->sc_i2c, flags);
@@ -409,7 +409,7 @@
        struct as3722_softc * const sc = smw->smw_cookie;
        int error;
 
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
 
        iic_acquire_bus(sc->sc_i2c, flags);
        error = as3722_set_clear(sc, AS3722_WATCHDOG_SIGNAL_REG,
@@ -426,7 +426,7 @@
        uint8_t buf[6];
        int error = 0;
 
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
 
        iic_acquire_bus(sc->sc_i2c, flags);
        error += as3722_read(sc, AS3722_RTC_SECOND_REG, &buf[0], flags);
@@ -468,7 +468,7 @@
        buf[4] = bintobcd(dt->dt_mon + 1) & 0x1f;
        buf[5] = bintobcd(dt->dt_year - AS3722_START_YEAR) & 0x7f;
 
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
 
        iic_acquire_bus(sc->sc_i2c, flags);
        error += as3722_write(sc, AS3722_RTC_SECOND_REG, buf[0], flags);
@@ -489,7 +489,7 @@
        struct as3722reg_attach_args raa;
        int phandle, child;
        int error;
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        uint8_t tmp;
 
        iic_acquire_bus(sc->sc_i2c, flags);
@@ -572,7 +572,7 @@
        struct as3722reg_softc *sc = device_private(dev);
        struct as3722_softc *asc = device_private(device_parent(dev));
        const struct as3722regdef *regdef = sc->sc_regdef;
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        int error;
 
        if (!regdef->enable_mask)
@@ -596,7 +596,7 @@
        struct as3722reg_softc *sc = device_private(dev);
        struct as3722_softc *asc = device_private(device_parent(dev));
        const struct as3722regdef *regdef = sc->sc_regdef;
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        uint8_t set_v = 0x00;
        u_int uvol;
        int error;
@@ -633,7 +633,7 @@
        struct as3722reg_softc *sc = device_private(dev);
        struct as3722_softc *asc = device_private(device_parent(dev));
        const struct as3722regdef *regdef = sc->sc_regdef;
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        uint8_t v;
        int error;
 
@@ -663,7 +663,7 @@
        struct as3722reg_softc *sc = device_private(dev);
        struct as3722_softc *asc = device_private(device_parent(dev));
        const struct as3722regdef *regdef = sc->sc_regdef;
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        uint8_t set_v = 0x00;
        u_int uvol;
        int error;
@@ -703,7 +703,7 @@
        struct as3722reg_softc *sc = device_private(dev);
        struct as3722_softc *asc = device_private(device_parent(dev));
        const struct as3722regdef *regdef = sc->sc_regdef;
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        uint8_t v;
        int error;
 
@@ -740,7 +740,7 @@
        struct as3722reg_softc *sc = device_private(dev);
        struct as3722_softc *asc = device_private(device_parent(dev));
        const struct as3722regdef *regdef = sc->sc_regdef;
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        uint8_t set_v = 0x00;
        u_int uvol;
        int error;
@@ -785,7 +785,7 @@
        struct as3722reg_softc *sc = device_private(dev);
        struct as3722_softc *asc = device_private(device_parent(dev));
        const struct as3722regdef *regdef = sc->sc_regdef;
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        uint8_t v;
        int error;
 
diff -r 0ab634321857 -r 185b1e010188 sys/dev/i2c/axp809.c
--- a/sys/dev/i2c/axp809.c      Sat Jul 27 16:00:02 2019 +0000
+++ b/sys/dev/i2c/axp809.c      Sat Jul 27 16:02:27 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: axp809.c,v 1.2 2018/06/16 21:22:13 thorpej Exp $ */
+/* $NetBSD: axp809.c,v 1.3 2019/07/27 16:02:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #define AXP_DEBUG
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: axp809.c,v 1.2 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axp809.c,v 1.3 2019/07/27 16:02:27 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -147,15 +147,13 @@
 static int
 axp809_read(struct axp809_softc *sc, uint8_t reg, uint8_t *val)
 {
-       return iic_smbus_read_byte(sc->sc_i2c, sc->sc_addr, reg, val,
-           cold ? I2C_F_POLL : 0);
+       return iic_smbus_read_byte(sc->sc_i2c, sc->sc_addr, reg, val, 0);
 }
 
 static int
 axp809_write(struct axp809_softc *sc, uint8_t reg, uint8_t val)
 {
-       return iic_smbus_write_byte(sc->sc_i2c, sc->sc_addr, reg, val,
-           cold ? I2C_F_POLL : 0);
+       return iic_smbus_write_byte(sc->sc_i2c, sc->sc_addr, reg, val, 0);
 }
 
 static void
diff -r 0ab634321857 -r 185b1e010188 sys/dev/i2c/axppmic.c
--- a/sys/dev/i2c/axppmic.c     Sat Jul 27 16:00:02 2019 +0000
+++ b/sys/dev/i2c/axppmic.c     Sat Jul 27 16:02:27 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: axppmic.c,v 1.24 2019/05/28 20:22:18 jmcneill Exp $ */
+/* $NetBSD: axppmic.c,v 1.25 2019/07/27 16:02:27 thorpej Exp $ */
 
 /*-
  * Copyright (c) 2014-2018 Jared McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.24 2019/05/28 20:22:18 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: axppmic.c,v 1.25 2019/07/27 16:02:27 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -481,7 +481,7 @@
 static int
 axppmic_set_voltage(i2c_tag_t tag, i2c_addr_t addr, const struct axppmic_ctrl *c, u_int min, u_int max)
 {
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        u_int vol, reg_val;
        int nstep, error;
        uint8_t val;
@@ -526,7 +526,7 @@
 static int
 axppmic_get_voltage(i2c_tag_t tag, i2c_addr_t addr, const struct axppmic_ctrl *c, u_int *pvol)
 {
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        int reg_val, error;
        uint8_t val;
 
@@ -1015,7 +1015,7 @@
 {
        struct axpreg_softc *sc = device_private(dev);
        const struct axppmic_ctrl *c = sc->sc_ctrl;
-       const int flags = (cold ? I2C_F_POLL : 0);
+       const int flags = 0;
        uint8_t val;
        int error;
 
diff -r 0ab634321857 -r 185b1e010188 sys/dev/i2c/em3027.c
--- a/sys/dev/i2c/em3027.c      Sat Jul 27 16:00:02 2019 +0000
+++ b/sys/dev/i2c/em3027.c      Sat Jul 27 16:02:27 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: em3027.c,v 1.2 2018/06/16 21:22:13 thorpej Exp $ */
+/*     $NetBSD: em3027.c,v 1.3 2019/07/27 16:02:27 thorpej Exp $ */
 /*
  * Copyright (c) 2018 Valery Ushakov
  * All rights reserved.
@@ -28,7 +28,7 @@
  * EM Microelectronic EM3027 RTC
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: em3027.c,v 1.2 2018/06/16 21:22:13 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: em3027.c,v 1.3 2019/07/27 16:02:27 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -320,7 +320,7 @@
 em3027rtc_iic_exec(struct em3027rtc_softc *sc, i2c_op_t op, uint8_t reg,
                   void *buf, size_t len)



Home | Main Index | Thread Index | Old Index