Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1736017

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

From Wolfram Sang <wsa+renesas@sang-engineering.com>
Newsgroups linux.kernel
Subject [RFC PATCH v5 5/6] i2c: rcar: skip DMA if buffer is not safe
Date 2017-09-20 21:10 +0200
Message-ID <urSxI-79x-25@gated-at.bofh.it> (permalink)
References <urSxH-79x-7@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 15d764afec3b29..8a2ae3e6c561c4 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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC PATCH v5 0/6] i2c: document DMA handling and add helpers for it Wolfram Sang <wsa+renesas@sang-engineering.com> - 2017-09-20 21:10 +0200
  [RFC PATCH v5 4/6] i2c: sh_mobile: use helper to decide if DMA is useful Wolfram Sang <wsa+renesas@sang-engineering.com> - 2017-09-20 21:10 +0200
  [RFC PATCH v5 2/6] i2c: add helpers to ease DMA handling Wolfram Sang <wsa+renesas@sang-engineering.com> - 2017-09-20 21:10 +0200
    Re: [RFC PATCH v5 2/6] i2c: add helpers to ease DMA handling Jonathan Cameron <Jonathan.Cameron@huawei.com> - 2017-09-21 16:10 +0200
      Re: [RFC PATCH v5 2/6] i2c: add helpers to ease DMA handling Jonathan Cameron <Jonathan.Cameron@huawei.com> - 2017-09-21 16:10 +0200
        Re: [RFC PATCH v5 2/6] i2c: add helpers to ease DMA handling Wolfram Sang <wsa@the-dreams.de> - 2017-09-21 16:20 +0200
          Re: [RFC PATCH v5 2/6] i2c: add helpers to ease DMA handling Jonathan Cameron <Jonathan.Cameron@huawei.com> - 2017-09-21 16:40 +0200
  [RFC PATCH v5 5/6] i2c: rcar: skip DMA if buffer is not safe Wolfram Sang <wsa+renesas@sang-engineering.com> - 2017-09-20 21:10 +0200
  [RFC PATCH v5 1/6] i2c: add a message flag for DMA safe buffers Wolfram Sang <wsa+renesas@sang-engineering.com> - 2017-09-20 21:10 +0200
  [RFC PATCH v5 3/6] i2c: add docs to clarify DMA handling Wolfram Sang <wsa+renesas@sang-engineering.com> - 2017-09-20 21:10 +0200
    Re: [RFC PATCH v5 3/6] i2c: add docs to clarify DMA handling Mauro Carvalho Chehab <mchehab@s-opensource.com> - 2017-09-20 22:00 +0200
      Re: [RFC PATCH v5 3/6] i2c: add docs to clarify DMA handling Jonathan Cameron <Jonathan.Cameron@huawei.com> - 2017-09-21 16:10 +0200

csiph-web