linux/drivers/dma/mediatek
Sascha Hauer 51fe9cd2bd dmaengine: virt-dma: Add missing locking
Originally freeing descriptors was split into a locked and an unlocked
part. The locked part in vchan_get_all_descriptors() collected all
descriptors on a separate list_head. This was done to allow iterating
over that new list in vchan_dma_desc_free_list() without a lock held.

This became broken in 13bb26ae88 ("dmaengine: virt-dma: don't always
free descriptor upon completion"). With this commit
vchan_dma_desc_free_list() no longer exclusively operates on the
separate list, but starts to put descriptors which can be reused back on
&vc->desc_allocated. This list operation should have been locked, but
wasn't.
In the mean time drivers started to call vchan_dma_desc_free_list() with
their lock held so that we now have the situation that
vchan_dma_desc_free_list() is called locked from some drivers and
unlocked from others.
To clean this up we have to do two things:

1. Add missing locking in vchan_dma_desc_free_list()
2. Make sure drivers call vchan_dma_desc_free_list() unlocked

This needs to be done atomically, so in this patch the locking is added
and all drivers are fixed.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Reviewed-by: Green Wan <green.wan@sifive.com>
Tested-by: Green Wan <green.wan@sifive.com>
Link: https://lore.kernel.org/r/20191216105328.15198-3-s.hauer@pengutronix.de
Signed-off-by: Vinod Koul <vkoul@kernel.org>
2019-12-26 10:04:18 +05:30
..
Kconfig dmaengine updates for v5.3-rc1 2019-07-17 09:55:43 -07:00
Makefile dmaengine updates for v5.3-rc1 2019-07-17 09:55:43 -07:00
mtk-cqdma.c dmaengine: mediatek: Use devm_platform_ioremap_resource() in mtk_cqdma_probe() 2019-10-14 13:21:20 +05:30
mtk-hsdma.c dmaengine: mediatek: hsdma_probe: fixed a memory leak when devm_request_irq fails 2019-11-14 12:16:53 +05:30
mtk-uart-apdma.c dmaengine: virt-dma: Add missing locking 2019-12-26 10:04:18 +05:30