diff options
| author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2017-11-14 09:32:11 -0500 |
|---|---|---|
| committer | Vinod Koul <vinod.koul@intel.com> | 2017-12-04 12:03:51 -0500 |
| commit | 3ee7e42f3c9b62c0283a26ea13b97a8dd7dad44d (patch) | |
| tree | 54f99e9db38ddc1f17cf1ff59a1a6039cb6702cc | |
| parent | 397c59bce6cbda05dc862b691e15ac2ef0ba1948 (diff) | |
dmaengine: k3dma: 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>
Acked-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Signed-off-by: Vinod Koul <vinod.koul@intel.com>
| -rw-r--r-- | drivers/dma/k3dma.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index 01d2a750a621..26b67455208f 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c | |||
| @@ -719,7 +719,7 @@ static int k3_dma_terminate_all(struct dma_chan *chan) | |||
| 719 | c->phy = NULL; | 719 | c->phy = NULL; |
| 720 | p->vchan = NULL; | 720 | p->vchan = NULL; |
| 721 | if (p->ds_run) { | 721 | if (p->ds_run) { |
| 722 | k3_dma_free_desc(&p->ds_run->vd); | 722 | vchan_terminate_vdesc(&p->ds_run->vd); |
| 723 | p->ds_run = NULL; | 723 | p->ds_run = NULL; |
| 724 | } | 724 | } |
| 725 | p->ds_done = NULL; | 725 | p->ds_done = NULL; |
| @@ -730,6 +730,13 @@ static int k3_dma_terminate_all(struct dma_chan *chan) | |||
| 730 | return 0; | 730 | return 0; |
| 731 | } | 731 | } |
| 732 | 732 | ||
| 733 | static void k3_dma_synchronize(struct dma_chan *chan) | ||
| 734 | { | ||
| 735 | struct k3_dma_chan *c = to_k3_chan(chan); | ||
| 736 | |||
| 737 | vchan_synchronize(&c->vc); | ||
| 738 | } | ||
| 739 | |||
| 733 | static int k3_dma_transfer_pause(struct dma_chan *chan) | 740 | static int k3_dma_transfer_pause(struct dma_chan *chan) |
| 734 | { | 741 | { |
| 735 | struct k3_dma_chan *c = to_k3_chan(chan); | 742 | struct k3_dma_chan *c = to_k3_chan(chan); |
| @@ -868,6 +875,7 @@ static int k3_dma_probe(struct platform_device *op) | |||
| 868 | d->slave.device_pause = k3_dma_transfer_pause; | 875 | d->slave.device_pause = k3_dma_transfer_pause; |
| 869 | d->slave.device_resume = k3_dma_transfer_resume; | 876 | d->slave.device_resume = k3_dma_transfer_resume; |
| 870 | d->slave.device_terminate_all = k3_dma_terminate_all; | 877 | d->slave.device_terminate_all = k3_dma_terminate_all; |
| 878 | d->slave.device_synchronize = k3_dma_synchronize; | ||
| 871 | d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES; | 879 | d->slave.copy_align = DMAENGINE_ALIGN_8_BYTES; |
| 872 | 880 | ||
| 873 | /* init virtual channel */ | 881 | /* init virtual channel */ |
