diff options
author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2017-11-14 09:32:08 -0500 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2017-12-04 12:03:51 -0500 |
commit | f0dd52c85d6145d63f9501718cdd24955cdab675 (patch) | |
tree | 5e1e0e2ba9b03deea402ed965057a84f1cee4ef8 | |
parent | de92436ac40ffe9933230aa503e24dbb5ede9201 (diff) |
dmaengine: dma-jz4780: Use vchan_terminate_vdesc() instead of desc_free
To avoid race with vchan_complete, use the race free way to terminate
running transfer.
Implement the device_synchronize callback to make sure that the terminated
descriptor is freed.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
-rw-r--r-- | drivers/dma/dma-jz4780.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/dma/dma-jz4780.c b/drivers/dma/dma-jz4780.c index 7373b7a555ec..85820a2d69d4 100644 --- a/drivers/dma/dma-jz4780.c +++ b/drivers/dma/dma-jz4780.c | |||
@@ -511,7 +511,7 @@ static int jz4780_dma_terminate_all(struct dma_chan *chan) | |||
511 | /* Clear the DMA status and stop the transfer. */ | 511 | /* Clear the DMA status and stop the transfer. */ |
512 | jz4780_dma_writel(jzdma, JZ_DMA_REG_DCS(jzchan->id), 0); | 512 | jz4780_dma_writel(jzdma, JZ_DMA_REG_DCS(jzchan->id), 0); |
513 | if (jzchan->desc) { | 513 | if (jzchan->desc) { |
514 | jz4780_dma_desc_free(&jzchan->desc->vdesc); | 514 | vchan_terminate_vdesc(&jzchan->desc->vdesc); |
515 | jzchan->desc = NULL; | 515 | jzchan->desc = NULL; |
516 | } | 516 | } |
517 | 517 | ||
@@ -523,6 +523,13 @@ static int jz4780_dma_terminate_all(struct dma_chan *chan) | |||
523 | return 0; | 523 | return 0; |
524 | } | 524 | } |
525 | 525 | ||
526 | static void jz4780_dma_synchronize(struct dma_chan *chan) | ||
527 | { | ||
528 | struct jz4780_dma_chan *jzchan = to_jz4780_dma_chan(chan); | ||
529 | |||
530 | vchan_synchronize(&jzchan->vchan); | ||
531 | } | ||
532 | |||
526 | static int jz4780_dma_config(struct dma_chan *chan, | 533 | static int jz4780_dma_config(struct dma_chan *chan, |
527 | struct dma_slave_config *config) | 534 | struct dma_slave_config *config) |
528 | { | 535 | { |
@@ -813,6 +820,7 @@ static int jz4780_dma_probe(struct platform_device *pdev) | |||
813 | dd->device_prep_dma_memcpy = jz4780_dma_prep_dma_memcpy; | 820 | dd->device_prep_dma_memcpy = jz4780_dma_prep_dma_memcpy; |
814 | dd->device_config = jz4780_dma_config; | 821 | dd->device_config = jz4780_dma_config; |
815 | dd->device_terminate_all = jz4780_dma_terminate_all; | 822 | dd->device_terminate_all = jz4780_dma_terminate_all; |
823 | dd->device_synchronize = jz4780_dma_synchronize; | ||
816 | dd->device_tx_status = jz4780_dma_tx_status; | 824 | dd->device_tx_status = jz4780_dma_tx_status; |
817 | dd->device_issue_pending = jz4780_dma_issue_pending; | 825 | dd->device_issue_pending = jz4780_dma_issue_pending; |
818 | dd->src_addr_widths = JZ_DMA_BUSWIDTHS; | 826 | dd->src_addr_widths = JZ_DMA_BUSWIDTHS; |