Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 1 Oct 2019 18:30:06 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352936 - head/sys/arm64/rockchip
Message-ID:  <201910011830.x91IU6tk066379@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Tue Oct  1 18:30:06 2019
New Revision: 352936
URL: https://svnweb.freebsd.org/changeset/base/352936

Log:
  arm64: rockchip: rk805: Switch to iicdev_{readfrom,writeto}
  
  This simpify the code a bit.

Modified:
  head/sys/arm64/rockchip/rk805.c

Modified: head/sys/arm64/rockchip/rk805.c
==============================================================================
--- head/sys/arm64/rockchip/rk805.c	Tue Oct  1 18:14:37 2019	(r352935)
+++ head/sys/arm64/rockchip/rk805.c	Tue Oct  1 18:30:06 2019	(r352936)
@@ -227,24 +227,16 @@ static struct rk805_regdef rk808_regdefs[] = {
 static int
 rk805_read(device_t dev, uint8_t reg, uint8_t *data, uint8_t size)
 {
+	int err;
 
-	return (iicdev_readfrom(dev, reg, data, size, IIC_INTRWAIT));
+	err = iicdev_readfrom(dev, reg, data, size, IIC_INTRWAIT);
+	return (err);
 }
 
 static int
 rk805_write(device_t dev, uint8_t reg, uint8_t data)
 {
-	struct iic_msg msg;
-	uint8_t buf[2];
-
-	buf[0] = reg;
-	buf[1] = data;
-	msg.slave = iicbus_get_addr(dev);
-	msg.flags = IIC_M_WR;
-	msg.buf = buf;
-	msg.len = sizeof(buf);
-
-	return (iicbus_transfer_excl(dev, &msg, 1, IIC_INTRWAIT));
+	return (iicdev_writeto(dev, reg, &data, 1, IIC_INTRWAIT));
 }
 
 static int



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910011830.x91IU6tk066379>