dma: sh: Fix callback processing order
Transfer request should be called after queue list is cleared.
Normal case:
__ld_cleanup();
__ld_cleanup();
shdma_tx_submit();
Illegal case:
__ld_cleanup();
shdma_tx_submit();
__ld_cleanup();
Since timeout error may occur if this illegal sequence occurs in MMC/SD
drivers, the __ld_cleanup() is called before callback function.
Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
(cherry picked from commit 305e22cf8bc9d30ad9685350cb91581689acab1c)
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
diff --git a/drivers/dma/sh/shdma-base.c b/drivers/dma/sh/shdma-base.c
index ca8564a..3760b97 100644
--- a/drivers/dma/sh/shdma-base.c
+++ b/drivers/dma/sh/shdma-base.c
@@ -405,10 +405,12 @@
spin_unlock_irqrestore(&schan->chan_lock, flags);
- if (callback)
+ if (callback) {
+ __ld_cleanup(schan, all);
callback(param);
+ }
- return callback;
+ return NULL;
}
/*
@@ -418,8 +420,7 @@
*/
static void shdma_chan_ld_cleanup(struct shdma_chan *schan, bool all)
{
- while (__ld_cleanup(schan, all))
- ;
+ __ld_cleanup(schan, all);
}
/*