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

This commit is contained in:
thorpej 2019-07-27 16:02:27 +00:00
parent 09453b8368
commit 4d2890e121
6 changed files with 34 additions and 40 deletions

View File

@ -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>
@ -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 @@ ac100_attach(device_t parent, device_t self, void *aux)
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

View File

@ -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>
@ -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 @@ act8846_attach(device_t parent, device_t self, void *aux)
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

View File

@ -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>
@ -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 @@ as3722_wdt_setmode(struct sysmon_wdog *smw)
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 @@ as3722_wdt_tickle(struct sysmon_wdog *smw)
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 @@ as3722_rtc_gettime(todr_chip_handle_t tch, struct clock_ymdhms *dt)
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 @@ as3722_rtc_settime(todr_chip_handle_t tch, struct clock_ymdhms *dt)
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 @@ as3722_regulator_attach(struct as3722_softc *sc)
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 @@ as3722reg_enable(device_t dev, bool enable)
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 @@ as3722reg_set_voltage_ldo(device_t dev, u_int min_uvol, u_int max_uvol)
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 @@ as3722reg_get_voltage_ldo(device_t dev, u_int *puvol)
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 @@ as3722reg_set_voltage_sd0(device_t dev, u_int min_uvol, u_int max_uvol)
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 @@ as3722reg_get_voltage_sd0(device_t dev, u_int *puvol)
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 @@ as3722reg_set_voltage_sd4(device_t dev, u_int min_uvol, u_int max_uvol)
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 @@ as3722reg_get_voltage_sd4(device_t dev, u_int *puvol)
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;

View File

@ -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>
@ -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 @@ axp809_attach(device_t parent, device_t self, void *aux)
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

View File

@ -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>
@ -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 @@ axppmic_write(i2c_tag_t tag, i2c_addr_t addr, uint8_t reg, uint8_t val, int flag
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 @@ axppmic_set_voltage(i2c_tag_t tag, i2c_addr_t addr, const struct axppmic_ctrl *c
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 @@ axpreg_enable(device_t dev, bool enable)
{
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;

View File

@ -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 @@ static int
em3027rtc_iic_exec(struct em3027rtc_softc *sc, i2c_op_t op, uint8_t reg,
void *buf, size_t len)
{
const int flags = cold ? 0 : I2C_F_POLL;
const int flags = 0;
int error;
error = iic_acquire_bus(sc->sc_tag, flags);