Index: sys/dev/iicbus/ds1672.c =================================================================== --- sys/dev/iicbus/ds1672.c (revision 350672) +++ sys/dev/iicbus/ds1672.c (working copy) @@ -71,28 +71,16 @@ static int ds1672_read(device_t dev, uint8_t addr, uint8_t *data, uint8_t size) { - struct iic_msg msgs[2] = { - { DS1672_ADDR, IIC_M_WR, 1, &addr }, - { DS1672_ADDR, IIC_M_RD, size, data } - }; - - return (iicbus_transfer(dev, msgs, 2)); + return (iicdev_readfrom(dev, addr, data, size, IIC_INTRWAIT)); } static int ds1672_write(device_t dev, uint8_t addr, uint8_t *data, uint8_t size) { - uint8_t buffer[MAX_IIC_DATA_SIZE + 1]; - struct iic_msg msgs[1] = { - { DS1672_ADDR, IIC_M_WR, size + 1, buffer }, - }; - if (size > MAX_IIC_DATA_SIZE) return (ENOMEM); - /* NB: register pointer precedes actual data */ - buffer[0] = addr; - memcpy(buffer + 1, data, size); - return (iicbus_transfer(dev, msgs, 1)); + + return (iicdev_writeto(dev, addr, data, size, IIC_INTRWAIT)); } static int Index: sys/dev/iicbus/sy8106a.c =================================================================== --- sys/dev/iicbus/sy8106a.c (revision 350672) +++ sys/dev/iicbus/sy8106a.c (working copy) @@ -83,42 +83,13 @@ static int sy8106a_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) { - struct sy8106a_softc *sc; - struct iic_msg msg[2]; - - sc = device_get_softc(dev); - - msg[0].slave = sc->addr; - msg[0].flags = IIC_M_WR; - msg[0].len = 1; - msg[0].buf = ® - - msg[1].slave = sc->addr; - msg[1].flags = IIC_M_RD; - msg[1].len = size; - msg[1].buf = data; - - return (iicbus_transfer(dev, msg, 2)); + return (iicdev_readfrom(dev, reg, data, size, IIC_INTRWAIT)); } static int sy8106a_write(device_t dev, uint8_t reg, uint8_t val) { - struct sy8106a_softc *sc; - struct iic_msg msg; - uint8_t buffer[2]; - - sc = device_get_softc(dev); - - buffer[0] = reg; - buffer[1] = val; - - msg.slave = sc->addr; - msg.flags = IIC_M_WR; - msg.len = 2; - msg.buf = buffer; - - return (iicbus_transfer(dev, &msg, 1)); + return (iicdev_writeto(dev, reg, &val, sizeof(val), IIC_INTRWAIT)); } static int Index: sys/dev/iicbus/syr827.c =================================================================== --- sys/dev/iicbus/syr827.c (revision 350672) +++ sys/dev/iicbus/syr827.c (working copy) @@ -90,42 +90,13 @@ static int syr827_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size) { - struct syr827_softc *sc; - struct iic_msg msg[2]; - - sc = device_get_softc(dev); - - msg[0].slave = sc->addr; - msg[0].flags = IIC_M_WR; - msg[0].len = 1; - msg[0].buf = ® - - msg[1].slave = sc->addr; - msg[1].flags = IIC_M_RD; - msg[1].len = size; - msg[1].buf = data; - - return (iicbus_transfer(dev, msg, 2)); + return (iicdev_readfrom(dev, reg, data, size, IIC_INTRWAIT)); } static int syr827_write(device_t dev, uint8_t reg, uint8_t val) { - struct syr827_softc *sc; - struct iic_msg msg; - uint8_t buffer[2]; - - sc = device_get_softc(dev); - - buffer[0] = reg; - buffer[1] = val; - - msg.slave = sc->addr; - msg.flags = IIC_M_WR; - msg.len = 2; - msg.buf = buffer; - - return (iicbus_transfer(dev, &msg, 1)); + return (iicdev_writeto(dev, reg, &val, sizeof(val), IIC_INTRWAIT)); } static int