Thread (16 messages) 16 messages, 4 authors, 2017-09-20

[RFC PATCH v4 5/6] i2c: rcar: skip DMA if buffer is not safe

From: Wolfram Sang <wsa+renesas@sang-engineering.com>
Date: 2017-08-17 14:15:51
Also in: dri-devel, linux-i2c, linux-iio, linux-media, linux-renesas-soc, lkml
Subsystem: i2c subsystem, i2c subsystem host drivers, renesas r-car i2c drivers, the rest · Maintainers: Wolfram Sang, Andi Shyti, Linus Torvalds

This HW is prone to races, so it needs to setup new messages in irq
context. That means we can't alloc bounce buffers if a message buffer is
not DMA safe. So, in that case, simply fall back to PIO.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-rcar.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 93c1a54981df08..5654a7142bffec 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -359,7 +359,7 @@ static void rcar_i2c_dma(struct rcar_i2c_priv *priv)
 	int len;
 
 	/* Do not use DMA if it's not available or for messages < 8 bytes */
-	if (IS_ERR(chan) || msg->len < 8)
+	if (IS_ERR(chan) || msg->len < 8 || !(msg->flags & I2C_M_DMA_SAFE))
 		return;
 
 	if (read) {
-- 
2.11.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help