LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH 0/7] i2c: use proper DMAENGINE API for termination
@ 2021-06-23  9:59 Wolfram Sang
  2021-06-23  9:59 ` [PATCH 1/7] i2c: at91-master: : " Wolfram Sang
                   ` (7 more replies)
  0 siblings, 8 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23  9:59 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Wolfram Sang, linux-arm-kernel, linux-arm-msm,
	linux-i2c, linux-kernel, linux-stm32

dmaengine_terminate_all() is deprecated in favor of explicitly saying if
it should be sync or async. Update the drivers I audited.


Wolfram Sang (7):
  i2c: at91-master: : use proper DMAENGINE API for termination
  i2c: imx: : use proper DMAENGINE API for termination
  i2c: mxs: : use proper DMAENGINE API for termination
  i2c: qup: : use proper DMAENGINE API for termination
  i2c: rcar: : use proper DMAENGINE API for termination
  i2c: sh_mobile: : use proper DMAENGINE API for termination
  i2c: stm32f7: : use proper DMAENGINE API for termination

 drivers/i2c/busses/i2c-at91-master.c | 4 ++--
 drivers/i2c/busses/i2c-imx.c         | 6 +++---
 drivers/i2c/busses/i2c-mxs.c         | 4 ++--
 drivers/i2c/busses/i2c-qup.c         | 2 +-
 drivers/i2c/busses/i2c-rcar.c        | 4 ++--
 drivers/i2c/busses/i2c-sh_mobile.c   | 4 ++--
 drivers/i2c/busses/i2c-stm32f7.c     | 8 ++++----
 7 files changed, 16 insertions(+), 16 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 1/7] i2c: at91-master: : use proper DMAENGINE API for termination
  2021-06-23  9:59 [PATCH 0/7] i2c: use proper DMAENGINE API for termination Wolfram Sang
@ 2021-06-23  9:59 ` Wolfram Sang
  2021-07-13  9:07   ` Codrin.Ciubotariu
  2021-08-11 13:24   ` Wolfram Sang
  2021-06-23  9:59 ` [PATCH 2/7] i2c: imx: " Wolfram Sang
                   ` (6 subsequent siblings)
  7 siblings, 2 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23  9:59 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Wolfram Sang, Codrin Ciubotariu,
	Nicolas Ferre, Alexandre Belloni, Ludovic Desroches, linux-i2c,
	linux-arm-kernel, linux-kernel

dmaengine_terminate_all() is deprecated in favor of explicitly saying if
it should be sync or async. Here, we want dmaengine_terminate_sync()
because there is no other synchronization code in the driver to handle
an async case.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-at91-master.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c
index 1cceb6866689..b0eae94909f4 100644
--- a/drivers/i2c/busses/i2c-at91-master.c
+++ b/drivers/i2c/busses/i2c-at91-master.c
@@ -138,9 +138,9 @@ static void at91_twi_dma_cleanup(struct at91_twi_dev *dev)
 
 	if (dma->xfer_in_progress) {
 		if (dma->direction == DMA_FROM_DEVICE)
-			dmaengine_terminate_all(dma->chan_rx);
+			dmaengine_terminate_sync(dma->chan_rx);
 		else
-			dmaengine_terminate_all(dma->chan_tx);
+			dmaengine_terminate_sync(dma->chan_tx);
 		dma->xfer_in_progress = false;
 	}
 	if (dma->buf_mapped) {
-- 
2.30.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 2/7] i2c: imx: : use proper DMAENGINE API for termination
  2021-06-23  9:59 [PATCH 0/7] i2c: use proper DMAENGINE API for termination Wolfram Sang
  2021-06-23  9:59 ` [PATCH 1/7] i2c: at91-master: : " Wolfram Sang
@ 2021-06-23  9:59 ` Wolfram Sang
  2021-06-25 12:06   ` Oleksij Rempel
  2021-08-11 13:24   ` Wolfram Sang
  2021-06-23  9:59 ` [PATCH 3/7] i2c: mxs: " Wolfram Sang
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23  9:59 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Wolfram Sang, Oleksij Rempel,
	Pengutronix Kernel Team, Shawn Guo, Sascha Hauer, Fabio Estevam,
	NXP Linux Team, linux-i2c, linux-arm-kernel, linux-kernel

dmaengine_terminate_all() is deprecated in favor of explicitly saying if
it should be sync or async. Here, we want dmaengine_terminate_sync()
because there is no other synchronization code in the driver to handle
an async case.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-imx.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index dc5ca71906db..b224e82924d2 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -423,7 +423,7 @@ static int i2c_imx_dma_xfer(struct imx_i2c_struct *i2c_imx,
 	return 0;
 
 err_submit:
-	dmaengine_terminate_all(dma->chan_using);
+	dmaengine_terminate_sync(dma->chan_using);
 err_desc:
 	dma_unmap_single(chan_dev, dma->dma_buf,
 			dma->dma_len, dma->dma_data_dir);
@@ -899,7 +899,7 @@ static int i2c_imx_dma_write(struct imx_i2c_struct *i2c_imx,
 				&i2c_imx->dma->cmd_complete,
 				msecs_to_jiffies(DMA_TIMEOUT));
 	if (time_left == 0) {
-		dmaengine_terminate_all(dma->chan_using);
+		dmaengine_terminate_sync(dma->chan_using);
 		return -ETIMEDOUT;
 	}
 
@@ -954,7 +954,7 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx,
 				&i2c_imx->dma->cmd_complete,
 				msecs_to_jiffies(DMA_TIMEOUT));
 	if (time_left == 0) {
-		dmaengine_terminate_all(dma->chan_using);
+		dmaengine_terminate_sync(dma->chan_using);
 		return -ETIMEDOUT;
 	}
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 3/7] i2c: mxs: : use proper DMAENGINE API for termination
  2021-06-23  9:59 [PATCH 0/7] i2c: use proper DMAENGINE API for termination Wolfram Sang
  2021-06-23  9:59 ` [PATCH 1/7] i2c: at91-master: : " Wolfram Sang
  2021-06-23  9:59 ` [PATCH 2/7] i2c: imx: " Wolfram Sang
@ 2021-06-23  9:59 ` Wolfram Sang
  2021-08-11 13:24   ` Wolfram Sang
  2021-06-23  9:59 ` [PATCH 4/7] i2c: qup: " Wolfram Sang
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23  9:59 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Wolfram Sang, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	linux-i2c, linux-arm-kernel, linux-kernel

dmaengine_terminate_all() is deprecated in favor of explicitly saying if
it should be sync or async. Here, we want dmaengine_terminate_sync()
because there is no other synchronization code in the driver to handle
an async case.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-mxs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index f97243f02231..864a3f1bd4e1 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -290,14 +290,14 @@ static int mxs_i2c_dma_setup_xfer(struct i2c_adapter *adap,
 select_init_dma_fail:
 	dma_unmap_sg(i2c->dev, &i2c->sg_io[0], 1, DMA_TO_DEVICE);
 select_init_pio_fail:
-	dmaengine_terminate_all(i2c->dmach);
+	dmaengine_terminate_sync(i2c->dmach);
 	return -EINVAL;
 
 /* Write failpath. */
 write_init_dma_fail:
 	dma_unmap_sg(i2c->dev, i2c->sg_io, 2, DMA_TO_DEVICE);
 write_init_pio_fail:
-	dmaengine_terminate_all(i2c->dmach);
+	dmaengine_terminate_sync(i2c->dmach);
 	return -EINVAL;
 }
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 4/7] i2c: qup: : use proper DMAENGINE API for termination
  2021-06-23  9:59 [PATCH 0/7] i2c: use proper DMAENGINE API for termination Wolfram Sang
                   ` (2 preceding siblings ...)
  2021-06-23  9:59 ` [PATCH 3/7] i2c: mxs: " Wolfram Sang
@ 2021-06-23  9:59 ` Wolfram Sang
  2021-08-11 13:24   ` Wolfram Sang
  2021-06-23  9:59 ` [PATCH 5/7] i2c: rcar: " Wolfram Sang
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23  9:59 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Wolfram Sang, Andy Gross, Bjorn Andersson,
	linux-arm-msm, linux-i2c, linux-kernel

dmaengine_terminate_all() is deprecated in favor of explicitly saying if
it should be sync or async. Here, we want dmaengine_terminate_sync()
because there is no other synchronization code in the driver to handle
an async case.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-qup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-qup.c b/drivers/i2c/busses/i2c-qup.c
index 61dc20fd1191..fcd35e8de83c 100644
--- a/drivers/i2c/busses/i2c-qup.c
+++ b/drivers/i2c/busses/i2c-qup.c
@@ -778,7 +778,7 @@ static int qup_i2c_bam_schedule_desc(struct qup_i2c_dev *qup)
 			ret = -EINVAL;
 
 			/* abort TX descriptors */
-			dmaengine_terminate_all(qup->btx.dma);
+			dmaengine_terminate_sync(qup->btx.dma);
 			goto desc_err;
 		}
 
-- 
2.30.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 5/7] i2c: rcar: : use proper DMAENGINE API for termination
  2021-06-23  9:59 [PATCH 0/7] i2c: use proper DMAENGINE API for termination Wolfram Sang
                   ` (3 preceding siblings ...)
  2021-06-23  9:59 ` [PATCH 4/7] i2c: qup: " Wolfram Sang
@ 2021-06-23  9:59 ` Wolfram Sang
  2021-06-23 14:02   ` Geert Uytterhoeven
  2021-06-23  9:59 ` [PATCH 6/7] i2c: sh_mobile: " Wolfram Sang
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23  9:59 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Wolfram Sang, linux-i2c, linux-kernel

dmaengine_terminate_all() is deprecated in favor of explicitly saying if
it should be sync or async. Here, we want dmaengine_terminate_sync()
because there is no other synchronization code in the driver to handle
an async case.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-rcar.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c
index 327c092a4130..41ff327882ef 100644
--- a/drivers/i2c/busses/i2c-rcar.c
+++ b/drivers/i2c/busses/i2c-rcar.c
@@ -391,9 +391,9 @@ static void rcar_i2c_cleanup_dma(struct rcar_i2c_priv *priv)
 	if (priv->dma_direction == DMA_NONE)
 		return;
 	else if (priv->dma_direction == DMA_FROM_DEVICE)
-		dmaengine_terminate_all(priv->dma_rx);
+		dmaengine_terminate_sync(priv->dma_rx);
 	else if (priv->dma_direction == DMA_TO_DEVICE)
-		dmaengine_terminate_all(priv->dma_tx);
+		dmaengine_terminate_sync(priv->dma_tx);
 
 	rcar_i2c_dma_unmap(priv);
 }
-- 
2.30.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 6/7] i2c: sh_mobile: : use proper DMAENGINE API for termination
  2021-06-23  9:59 [PATCH 0/7] i2c: use proper DMAENGINE API for termination Wolfram Sang
                   ` (4 preceding siblings ...)
  2021-06-23  9:59 ` [PATCH 5/7] i2c: rcar: " Wolfram Sang
@ 2021-06-23  9:59 ` Wolfram Sang
  2021-08-11 13:24   ` Wolfram Sang
  2021-06-23  9:59 ` [PATCH 7/7] i2c: stm32f7: " Wolfram Sang
  2021-08-11 13:26 ` [PATCH 0/7] i2c: " Wolfram Sang
  7 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23  9:59 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, Wolfram Sang, linux-i2c, linux-kernel

dmaengine_terminate_all() is deprecated in favor of explicitly saying if
it should be sync or async. Here, we want dmaengine_terminate_sync()
because there is no other synchronization code in the driver to handle
an async case.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-sh_mobile.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 2d2e630fd438..db8fa4186814 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -458,9 +458,9 @@ static void sh_mobile_i2c_cleanup_dma(struct sh_mobile_i2c_data *pd)
 	if (pd->dma_direction == DMA_NONE)
 		return;
 	else if (pd->dma_direction == DMA_FROM_DEVICE)
-		dmaengine_terminate_all(pd->dma_rx);
+		dmaengine_terminate_sync(pd->dma_rx);
 	else if (pd->dma_direction == DMA_TO_DEVICE)
-		dmaengine_terminate_all(pd->dma_tx);
+		dmaengine_terminate_sync(pd->dma_tx);
 
 	sh_mobile_i2c_dma_unmap(pd);
 }
-- 
2.30.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

* [PATCH 7/7] i2c: stm32f7: : use proper DMAENGINE API for termination
  2021-06-23  9:59 [PATCH 0/7] i2c: use proper DMAENGINE API for termination Wolfram Sang
                   ` (5 preceding siblings ...)
  2021-06-23  9:59 ` [PATCH 6/7] i2c: sh_mobile: " Wolfram Sang
@ 2021-06-23  9:59 ` Wolfram Sang
  2021-06-23 14:03   ` Wolfram Sang
  2021-08-11 13:26 ` [PATCH 0/7] i2c: " Wolfram Sang
  7 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23  9:59 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Wolfram Sang, Pierre-Yves MORDRET,
	Alain Volmat, Maxime Coquelin, Alexandre Torgue, linux-i2c,
	linux-stm32, linux-arm-kernel, linux-kernel

dmaengine_terminate_all() is deprecated in favor of explicitly saying if
it should be sync or async. Here, we want dmaengine_terminate_sync()
because there is no other synchronization code in the driver to handle
an async case.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-stm32f7.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-stm32f7.c b/drivers/i2c/busses/i2c-stm32f7.c
index 0138317ea600..9ea074a7ced6 100644
--- a/drivers/i2c/busses/i2c-stm32f7.c
+++ b/drivers/i2c/busses/i2c-stm32f7.c
@@ -1567,7 +1567,7 @@ static irqreturn_t stm32f7_i2c_isr_event_thread(int irq, void *data)
 	if (!ret) {
 		dev_dbg(i2c_dev->dev, "<%s>: Timed out\n", __func__);
 		stm32f7_i2c_disable_dma_req(i2c_dev);
-		dmaengine_terminate_all(dma->chan_using);
+		dmaengine_terminate_sync(dma->chan_using);
 		f7_msg->result = -ETIMEDOUT;
 	}
 
@@ -1637,7 +1637,7 @@ static irqreturn_t stm32f7_i2c_isr_error(int irq, void *data)
 	/* Disable dma */
 	if (i2c_dev->use_dma) {
 		stm32f7_i2c_disable_dma_req(i2c_dev);
-		dmaengine_terminate_all(dma->chan_using);
+		dmaengine_terminate_sync(dma->chan_using);
 	}
 
 	i2c_dev->master_mode = false;
@@ -1678,7 +1678,7 @@ static int stm32f7_i2c_xfer(struct i2c_adapter *i2c_adap,
 		dev_dbg(i2c_dev->dev, "Access to slave 0x%x timed out\n",
 			i2c_dev->msg->addr);
 		if (i2c_dev->use_dma)
-			dmaengine_terminate_all(dma->chan_using);
+			dmaengine_terminate_sync(dma->chan_using);
 		ret = -ETIMEDOUT;
 	}
 
@@ -1727,7 +1727,7 @@ static int stm32f7_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr,
 	if (!timeout) {
 		dev_dbg(dev, "Access to slave 0x%x timed out\n", f7_msg->addr);
 		if (i2c_dev->use_dma)
-			dmaengine_terminate_all(dma->chan_using);
+			dmaengine_terminate_sync(dma->chan_using);
 		ret = -ETIMEDOUT;
 		goto pm_free;
 	}
-- 
2.30.2


^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 5/7] i2c: rcar: : use proper DMAENGINE API for termination
  2021-06-23  9:59 ` [PATCH 5/7] i2c: rcar: " Wolfram Sang
@ 2021-06-23 14:02   ` Geert Uytterhoeven
  2021-06-23 14:08     ` Wolfram Sang
  0 siblings, 1 reply; 22+ messages in thread
From: Geert Uytterhoeven @ 2021-06-23 14:02 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Linux MMC List, Linux-Renesas, Linux I2C, Linux Kernel Mailing List

Hi Wolfram,

On Wed, Jun 23, 2021 at 12:01 PM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks for your patch!

Is this safe? The driver is not using a threaded irq, and DMA termination
may be called from the interrupt handler.

Have you tried triggering DMA termination, with lockdep enabled?

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 7/7] i2c: stm32f7: : use proper DMAENGINE API for termination
  2021-06-23  9:59 ` [PATCH 7/7] i2c: stm32f7: " Wolfram Sang
@ 2021-06-23 14:03   ` Wolfram Sang
  2021-06-30 13:11     ` Alain Volmat
  0 siblings, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23 14:03 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Pierre-Yves MORDRET, Alain Volmat,
	Maxime Coquelin, Alexandre Torgue, linux-i2c, linux-stm32,
	linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

On Wed, Jun 23, 2021 at 11:59:41AM +0200, Wolfram Sang wrote:
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Eeks, this is called from irq context as well. Broken patch :(


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 5/7] i2c: rcar: : use proper DMAENGINE API for termination
  2021-06-23 14:02   ` Geert Uytterhoeven
@ 2021-06-23 14:08     ` Wolfram Sang
  0 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-06-23 14:08 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux MMC List, Linux-Renesas, Linux I2C, Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 428 bytes --]


> Is this safe? The driver is not using a threaded irq, and DMA termination
> may be called from the interrupt handler.

You are right, this will not work. Not my best day today, I overlooked
it for i2c-rcar and lost the note pointing out the same issue for
stm32f7 :(

> Have you tried triggering DMA termination, with lockdep enabled?

Nope. As the code didn't show signs of async nature, I assumed sync was
desired anyhow.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/7] i2c: imx: : use proper DMAENGINE API for termination
  2021-06-23  9:59 ` [PATCH 2/7] i2c: imx: " Wolfram Sang
@ 2021-06-25 12:06   ` Oleksij Rempel
  2021-08-11 13:24   ` Wolfram Sang
  1 sibling, 0 replies; 22+ messages in thread
From: Oleksij Rempel @ 2021-06-25 12:06 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-mmc, linux-renesas-soc, Oleksij Rempel,
	Pengutronix Kernel Team, Shawn Guo, Sascha Hauer, Fabio Estevam,
	NXP Linux Team, linux-i2c, linux-arm-kernel, linux-kernel

Hello Wolfram,

On Wed, Jun 23, 2021 at 11:59:36AM +0200, Wolfram Sang wrote:
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Oleksij Rempel <o.rempel@pengutronix.de

Thank you!

> ---
>  drivers/i2c/busses/i2c-imx.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index dc5ca71906db..b224e82924d2 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -423,7 +423,7 @@ static int i2c_imx_dma_xfer(struct imx_i2c_struct *i2c_imx,
>  	return 0;
>  
>  err_submit:
> -	dmaengine_terminate_all(dma->chan_using);
> +	dmaengine_terminate_sync(dma->chan_using);
>  err_desc:
>  	dma_unmap_single(chan_dev, dma->dma_buf,
>  			dma->dma_len, dma->dma_data_dir);
> @@ -899,7 +899,7 @@ static int i2c_imx_dma_write(struct imx_i2c_struct *i2c_imx,
>  				&i2c_imx->dma->cmd_complete,
>  				msecs_to_jiffies(DMA_TIMEOUT));
>  	if (time_left == 0) {
> -		dmaengine_terminate_all(dma->chan_using);
> +		dmaengine_terminate_sync(dma->chan_using);
>  		return -ETIMEDOUT;
>  	}
>  
> @@ -954,7 +954,7 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx,
>  				&i2c_imx->dma->cmd_complete,
>  				msecs_to_jiffies(DMA_TIMEOUT));
>  	if (time_left == 0) {
> -		dmaengine_terminate_all(dma->chan_using);
> +		dmaengine_terminate_sync(dma->chan_using);
>  		return -ETIMEDOUT;
>  	}
>  
> -- 
> 2.30.2
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 7/7] i2c: stm32f7: : use proper DMAENGINE API for termination
  2021-06-23 14:03   ` Wolfram Sang
@ 2021-06-30 13:11     ` Alain Volmat
  2021-06-30 13:48       ` Wolfram Sang
  0 siblings, 1 reply; 22+ messages in thread
From: Alain Volmat @ 2021-06-30 13:11 UTC (permalink / raw)
  To: Wolfram Sang, linux-mmc, linux-renesas-soc, Pierre-Yves MORDRET,
	Maxime Coquelin, Alexandre Torgue, linux-i2c, linux-stm32,
	linux-arm-kernel, linux-kernel

Hi Wolfram,

thanks for the update. If you are ok with that I modify the patch
to partially rely on _async / synchronize whenever needed and push it again
separately.

Regards,
Alain

On Wed, Jun 23, 2021 at 04:03:57PM +0200, Wolfram Sang wrote:
> On Wed, Jun 23, 2021 at 11:59:41AM +0200, Wolfram Sang wrote:
> > dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> > it should be sync or async. Here, we want dmaengine_terminate_sync()
> > because there is no other synchronization code in the driver to handle
> > an async case.
> > 
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Eeks, this is called from irq context as well. Broken patch :(
> 



^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 7/7] i2c: stm32f7: : use proper DMAENGINE API for termination
  2021-06-30 13:11     ` Alain Volmat
@ 2021-06-30 13:48       ` Wolfram Sang
  0 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-06-30 13:48 UTC (permalink / raw)
  To: linux-mmc, linux-renesas-soc, Pierre-Yves MORDRET,
	Maxime Coquelin, Alexandre Torgue, linux-i2c, linux-stm32,
	linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 217 bytes --]

Hi Alain,

> thanks for the update. If you are ok with that I modify the patch
> to partially rely on _async / synchronize whenever needed and push it again
> separately.

Perfect, thanks!

All the best,

   Wolfram


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/7] i2c: at91-master: : use proper DMAENGINE API for termination
  2021-06-23  9:59 ` [PATCH 1/7] i2c: at91-master: : " Wolfram Sang
@ 2021-07-13  9:07   ` Codrin.Ciubotariu
  2021-08-11 13:24   ` Wolfram Sang
  1 sibling, 0 replies; 22+ messages in thread
From: Codrin.Ciubotariu @ 2021-07-13  9:07 UTC (permalink / raw)
  To: wsa+renesas, linux-mmc
  Cc: linux-renesas-soc, Nicolas.Ferre, alexandre.belloni,
	Ludovic.Desroches, linux-i2c, linux-arm-kernel, linux-kernel

On 23.06.2021 12:59, Wolfram Sang wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Reviewed-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>

Thanks!

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/7] i2c: at91-master: : use proper DMAENGINE API for termination
  2021-06-23  9:59 ` [PATCH 1/7] i2c: at91-master: : " Wolfram Sang
  2021-07-13  9:07   ` Codrin.Ciubotariu
@ 2021-08-11 13:24   ` Wolfram Sang
  2021-08-11 13:34     ` Codrin.Ciubotariu
  1 sibling, 1 reply; 22+ messages in thread
From: Wolfram Sang @ 2021-08-11 13:24 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Codrin Ciubotariu, Nicolas Ferre,
	Alexandre Belloni, Ludovic Desroches, linux-i2c,
	linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On Wed, Jun 23, 2021 at 11:59:35AM +0200, Wolfram Sang wrote:
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 2/7] i2c: imx: : use proper DMAENGINE API for termination
  2021-06-23  9:59 ` [PATCH 2/7] i2c: imx: " Wolfram Sang
  2021-06-25 12:06   ` Oleksij Rempel
@ 2021-08-11 13:24   ` Wolfram Sang
  1 sibling, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-08-11 13:24 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Oleksij Rempel, Pengutronix Kernel Team,
	Shawn Guo, Sascha Hauer, Fabio Estevam, NXP Linux Team,
	linux-i2c, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On Wed, Jun 23, 2021 at 11:59:36AM +0200, Wolfram Sang wrote:
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 3/7] i2c: mxs: : use proper DMAENGINE API for termination
  2021-06-23  9:59 ` [PATCH 3/7] i2c: mxs: " Wolfram Sang
@ 2021-08-11 13:24   ` Wolfram Sang
  0 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-08-11 13:24 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	linux-i2c, linux-arm-kernel, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On Wed, Jun 23, 2021 at 11:59:37AM +0200, Wolfram Sang wrote:
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 4/7] i2c: qup: : use proper DMAENGINE API for termination
  2021-06-23  9:59 ` [PATCH 4/7] i2c: qup: " Wolfram Sang
@ 2021-08-11 13:24   ` Wolfram Sang
  0 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-08-11 13:24 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, Andy Gross, Bjorn Andersson, linux-arm-msm,
	linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On Wed, Jun 23, 2021 at 11:59:38AM +0200, Wolfram Sang wrote:
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 6/7] i2c: sh_mobile: : use proper DMAENGINE API for termination
  2021-06-23  9:59 ` [PATCH 6/7] i2c: sh_mobile: " Wolfram Sang
@ 2021-08-11 13:24   ` Wolfram Sang
  0 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-08-11 13:24 UTC (permalink / raw)
  To: linux-mmc; +Cc: linux-renesas-soc, linux-i2c, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 407 bytes --]

On Wed, Jun 23, 2021 at 11:59:40AM +0200, Wolfram Sang wrote:
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Here, we want dmaengine_terminate_sync()
> because there is no other synchronization code in the driver to handle
> an async case.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Applied to for-next, thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 0/7] i2c: use proper DMAENGINE API for termination
  2021-06-23  9:59 [PATCH 0/7] i2c: use proper DMAENGINE API for termination Wolfram Sang
                   ` (6 preceding siblings ...)
  2021-06-23  9:59 ` [PATCH 7/7] i2c: stm32f7: " Wolfram Sang
@ 2021-08-11 13:26 ` Wolfram Sang
  7 siblings, 0 replies; 22+ messages in thread
From: Wolfram Sang @ 2021-08-11 13:26 UTC (permalink / raw)
  To: linux-mmc
  Cc: linux-renesas-soc, linux-arm-kernel, linux-arm-msm, linux-i2c,
	linux-kernel, linux-stm32

[-- Attachment #1: Type: text/plain, Size: 427 bytes --]

On Wed, Jun 23, 2021 at 11:59:34AM +0200, Wolfram Sang wrote:
> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
> it should be sync or async. Update the drivers I audited.

I applied the patches now, except for i2c-rcar and i2c-stm32f7 where
this approach can't be used because of interrupt context. I will check
for i2c-rcar how to do this properly and Alain for i2c-stm32f7 and we
will resend then.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread

* Re: [PATCH 1/7] i2c: at91-master: : use proper DMAENGINE API for termination
  2021-08-11 13:24   ` Wolfram Sang
@ 2021-08-11 13:34     ` Codrin.Ciubotariu
  0 siblings, 0 replies; 22+ messages in thread
From: Codrin.Ciubotariu @ 2021-08-11 13:34 UTC (permalink / raw)
  To: wsa+renesas, linux-mmc, linux-renesas-soc, Nicolas.Ferre,
	alexandre.belloni, Ludovic.Desroches, linux-i2c,
	linux-arm-kernel, linux-kernel

On 11.08.2021 16:24, Wolfram Sang wrote:
> On Wed, Jun 23, 2021 at 11:59:35AM +0200, Wolfram Sang wrote:
>> dmaengine_terminate_all() is deprecated in favor of explicitly saying if
>> it should be sync or async. Here, we want dmaengine_terminate_sync()
>> because there is no other synchronization code in the driver to handle
>> an async case.
>>
>> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> 
> Applied to for-next, thanks!
> 

just saw it now, there is a double : :  in the subject. Maybe you could 
fix it if it's not too late...

Thanks and best regards,
Codrin

^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2021-08-11 13:34 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-23  9:59 [PATCH 0/7] i2c: use proper DMAENGINE API for termination Wolfram Sang
2021-06-23  9:59 ` [PATCH 1/7] i2c: at91-master: : " Wolfram Sang
2021-07-13  9:07   ` Codrin.Ciubotariu
2021-08-11 13:24   ` Wolfram Sang
2021-08-11 13:34     ` Codrin.Ciubotariu
2021-06-23  9:59 ` [PATCH 2/7] i2c: imx: " Wolfram Sang
2021-06-25 12:06   ` Oleksij Rempel
2021-08-11 13:24   ` Wolfram Sang
2021-06-23  9:59 ` [PATCH 3/7] i2c: mxs: " Wolfram Sang
2021-08-11 13:24   ` Wolfram Sang
2021-06-23  9:59 ` [PATCH 4/7] i2c: qup: " Wolfram Sang
2021-08-11 13:24   ` Wolfram Sang
2021-06-23  9:59 ` [PATCH 5/7] i2c: rcar: " Wolfram Sang
2021-06-23 14:02   ` Geert Uytterhoeven
2021-06-23 14:08     ` Wolfram Sang
2021-06-23  9:59 ` [PATCH 6/7] i2c: sh_mobile: " Wolfram Sang
2021-08-11 13:24   ` Wolfram Sang
2021-06-23  9:59 ` [PATCH 7/7] i2c: stm32f7: " Wolfram Sang
2021-06-23 14:03   ` Wolfram Sang
2021-06-30 13:11     ` Alain Volmat
2021-06-30 13:48       ` Wolfram Sang
2021-08-11 13:26 ` [PATCH 0/7] i2c: " Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).