Message ID | 20210623095942.3325-8-wsa+renesas@sang-engineering.com (mailing list archive) |
---|---|
State | Awaiting Upstream |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | i2c: use proper DMAENGINE API for termination | expand |
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 :(
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 :( >
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
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; }
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(-)