Commit cec9cfa8 authored by Vinod Koul's avatar Vinod Koul
Browse files

dmaengine: jz4740: kill the tasklets upon exit



drivers should ensure that tasklets are killed, so that they can't be
executed after driver remove is executed, so ensure they are killed.

This driver used vchan tasklets, so those need to be killed.

Signed-off-by: default avatarVinod Koul <vinod.koul@intel.com>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
parent f950f025
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -573,12 +573,26 @@ static int jz4740_dma_probe(struct platform_device *pdev)
	return ret;
}

static void jz4740_cleanup_vchan(struct dma_device *dmadev)
{
	struct jz4740_dmaengine_chan *chan, *_chan;

	list_for_each_entry_safe(chan, _chan,
				&dmadev->channels, vchan.chan.device_node) {
		list_del(&chan->vchan.chan.device_node);
		tasklet_kill(&chan->vchan.task);
	}
}


static int jz4740_dma_remove(struct platform_device *pdev)
{
	struct jz4740_dma_dev *dmadev = platform_get_drvdata(pdev);
	int irq = platform_get_irq(pdev, 0);

	free_irq(irq, dmadev);

	jz4740_cleanup_vchan(&dmadev->ddev);
	dma_async_device_unregister(&dmadev->ddev);
	clk_disable_unprepare(dmadev->clk);