mirror of
https://github.com/FEX-Emu/linux.git
synced 2024-12-22 17:33:01 +00:00
dmaengine/dw_dmac: don't call callback routine in case dmaengine_terminate_all() is called
If dmaengine_terminate_all() is called for dma channel, then it doesn't make much sense to call registered callback routine. While in case of success or failure it must be called. Signed-off-by: Viresh Kumar <viresh.kumar@st.com> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
This commit is contained in:
parent
de7a2f9f7b
commit
5fedefb87b
@ -195,18 +195,21 @@ static void dwc_dostart(struct dw_dma_chan *dwc, struct dw_desc *first)
|
||||
/*----------------------------------------------------------------------*/
|
||||
|
||||
static void
|
||||
dwc_descriptor_complete(struct dw_dma_chan *dwc, struct dw_desc *desc)
|
||||
dwc_descriptor_complete(struct dw_dma_chan *dwc, struct dw_desc *desc,
|
||||
bool callback_required)
|
||||
{
|
||||
dma_async_tx_callback callback;
|
||||
void *param;
|
||||
dma_async_tx_callback callback = NULL;
|
||||
void *param = NULL;
|
||||
struct dma_async_tx_descriptor *txd = &desc->txd;
|
||||
struct dw_desc *child;
|
||||
|
||||
dev_vdbg(chan2dev(&dwc->chan), "descriptor %u complete\n", txd->cookie);
|
||||
|
||||
dwc->completed = txd->cookie;
|
||||
callback = txd->callback;
|
||||
param = txd->callback_param;
|
||||
if (callback_required) {
|
||||
callback = txd->callback;
|
||||
param = txd->callback_param;
|
||||
}
|
||||
|
||||
dwc_sync_desc_for_cpu(dwc, desc);
|
||||
|
||||
@ -238,11 +241,7 @@ dwc_descriptor_complete(struct dw_dma_chan *dwc, struct dw_desc *desc)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The API requires that no submissions are done from a
|
||||
* callback, so we don't need to drop the lock here
|
||||
*/
|
||||
if (callback)
|
||||
if (callback_required && callback)
|
||||
callback(param);
|
||||
}
|
||||
|
||||
@ -272,7 +271,7 @@ static void dwc_complete_all(struct dw_dma *dw, struct dw_dma_chan *dwc)
|
||||
}
|
||||
|
||||
list_for_each_entry_safe(desc, _desc, &list, desc_node)
|
||||
dwc_descriptor_complete(dwc, desc);
|
||||
dwc_descriptor_complete(dwc, desc, true);
|
||||
}
|
||||
|
||||
static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
|
||||
@ -322,7 +321,7 @@ static void dwc_scan_descriptors(struct dw_dma *dw, struct dw_dma_chan *dwc)
|
||||
* No descriptors so far seem to be in progress, i.e.
|
||||
* this one must be done.
|
||||
*/
|
||||
dwc_descriptor_complete(dwc, desc);
|
||||
dwc_descriptor_complete(dwc, desc, true);
|
||||
}
|
||||
|
||||
dev_err(chan2dev(&dwc->chan),
|
||||
@ -384,7 +383,7 @@ static void dwc_handle_error(struct dw_dma *dw, struct dw_dma_chan *dwc)
|
||||
dwc_dump_lli(dwc, &child->lli);
|
||||
|
||||
/* Pretend the descriptor completed successfully */
|
||||
dwc_descriptor_complete(dwc, bad_desc);
|
||||
dwc_descriptor_complete(dwc, bad_desc, true);
|
||||
}
|
||||
|
||||
/* --------------------- Cyclic DMA API extensions -------------------- */
|
||||
@ -831,7 +830,7 @@ static int dwc_control(struct dma_chan *chan, enum dma_ctrl_cmd cmd,
|
||||
|
||||
/* Flush all pending and queued descriptors */
|
||||
list_for_each_entry_safe(desc, _desc, &list, desc_node)
|
||||
dwc_descriptor_complete(dwc, desc);
|
||||
dwc_descriptor_complete(dwc, desc, false);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user