[PATCH 12/12] i2c: meson: use state in meson_i2c_prepare_xfer

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Let's use the state here to make meson_i2c_prepare_xfer more in line
with other parts of the driver.

Signed-off-by: Heiner Kallweit <hkallweit1@xxxxxxxxx>
---
 drivers/i2c/busses/i2c-meson.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-meson.c b/drivers/i2c/busses/i2c-meson.c
index 7b29f077..eacb6f3d 100644
--- a/drivers/i2c/busses/i2c-meson.c
+++ b/drivers/i2c/busses/i2c-meson.c
@@ -181,7 +181,6 @@ static void meson_i2c_put_data(struct meson_i2c *i2c, char *buf, int len)
 
 static void meson_i2c_prepare_xfer(struct meson_i2c *i2c)
 {
-	bool write = !(i2c->msg->flags & I2C_M_RD);
 	int i;
 
 	i2c->count = min(i2c->msg->len - i2c->pos, 8);
@@ -189,7 +188,7 @@ static void meson_i2c_prepare_xfer(struct meson_i2c *i2c)
 	for (i = 0; i < i2c->count - 1; i++)
 		meson_i2c_add_token(i2c, TOKEN_DATA);
 
-	if (write || i2c->pos + i2c->count < i2c->msg->len)
+	if (i2c->state == STATE_WRITE || i2c->pos + i2c->count < i2c->msg->len)
 		meson_i2c_add_token(i2c, TOKEN_DATA);
 	else
 		meson_i2c_add_token(i2c, TOKEN_DATA_LAST);
@@ -197,7 +196,7 @@ static void meson_i2c_prepare_xfer(struct meson_i2c *i2c)
 	if (i2c->last && i2c->pos + i2c->count >= i2c->msg->len)
 		meson_i2c_add_token(i2c, TOKEN_STOP);
 
-	if (write)
+	if (i2c->state == STATE_WRITE)
 		meson_i2c_put_data(i2c, i2c->msg->buf + i2c->pos, i2c->count);
 
 	writel(i2c->tokens[0], i2c->regs + REG_TOK_LIST0);
-- 
2.12.0


--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux