Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/egtvedt...
[cascardo/linux.git] / drivers / dma / s3c24xx-dma.c
index 0d2d187..ce67075 100644 (file)
@@ -1136,8 +1136,10 @@ static void s3c24xx_dma_free_virtual_channels(struct dma_device *dmadev)
        struct s3c24xx_dma_chan *next;
 
        list_for_each_entry_safe(chan,
-                                next, &dmadev->channels, vc.chan.device_node)
+                                next, &dmadev->channels, vc.chan.device_node) {
                list_del(&chan->vc.chan.device_node);
+               tasklet_kill(&chan->vc.task);
+       }
 }
 
 /* s3c2410, s3c2440 and s3c2442 have a 0x40 stride without separate clocks */
@@ -1359,6 +1361,18 @@ err_memcpy:
        return ret;
 }
 
+static void s3c24xx_dma_free_irq(struct platform_device *pdev,
+                               struct s3c24xx_dma_engine *s3cdma)
+{
+       int i;
+
+       for (i = 0; i < s3cdma->pdata->num_phy_channels; i++) {
+               struct s3c24xx_dma_phy *phy = &s3cdma->phy_chans[i];
+
+               devm_free_irq(&pdev->dev, phy->irq, phy);
+       }
+}
+
 static int s3c24xx_dma_remove(struct platform_device *pdev)
 {
        const struct s3c24xx_dma_platdata *pdata = dev_get_platdata(&pdev->dev);
@@ -1369,6 +1383,8 @@ static int s3c24xx_dma_remove(struct platform_device *pdev)
        dma_async_device_unregister(&s3cdma->slave);
        dma_async_device_unregister(&s3cdma->memcpy);
 
+       s3c24xx_dma_free_irq(pdev, s3cdma);
+
        s3c24xx_dma_free_virtual_channels(&s3cdma->slave);
        s3c24xx_dma_free_virtual_channels(&s3cdma->memcpy);