diff options
author | Vinod Koul <vinod.koul@intel.com> | 2016-07-28 00:40:37 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@intel.com> | 2016-07-28 00:40:37 -0400 |
commit | 4bb0439626983fdde5af3ce970bd0ba2070f5378 (patch) | |
tree | 081166e9a6bd98eef39f41171f2e2ef014413bb3 | |
parent | 89b90c09b5d505dcff1068054f1fc2d2704e909f (diff) | |
parent | 184ff2aa3c0ba7f1cd44ed7e8d766e12e43694e2 (diff) |
Merge branch 'topic/dmaengine_cleanups' into for-linus
-rw-r--r-- | drivers/dma/coh901318.c | 30 | ||||
-rw-r--r-- | drivers/dma/cppi41.c | 3 | ||||
-rw-r--r-- | drivers/dma/dma-jz4740.c | 14 | ||||
-rw-r--r-- | drivers/dma/edma.c | 21 | ||||
-rw-r--r-- | drivers/dma/fsl-edma.c | 24 | ||||
-rw-r--r-- | drivers/dma/fsl_raid.c | 9 | ||||
-rw-r--r-- | drivers/dma/imx-dma.c | 31 | ||||
-rw-r--r-- | drivers/dma/imx-sdma.c | 9 | ||||
-rw-r--r-- | drivers/dma/ioat/init.c | 2 | ||||
-rw-r--r-- | drivers/dma/k3dma.c | 5 | ||||
-rw-r--r-- | drivers/dma/mmp_pdma.c | 19 | ||||
-rw-r--r-- | drivers/dma/mmp_tdma.c | 4 | ||||
-rw-r--r-- | drivers/dma/moxart-dma.c | 4 | ||||
-rw-r--r-- | drivers/dma/mpc512x_dma.c | 1 | ||||
-rw-r--r-- | drivers/dma/nbpfaxi.c | 13 | ||||
-rw-r--r-- | drivers/dma/omap-dma.c | 4 | ||||
-rw-r--r-- | drivers/dma/pl330.c | 6 | ||||
-rw-r--r-- | drivers/dma/pxa_dma.c | 16 | ||||
-rw-r--r-- | drivers/dma/qcom/hidma.c | 1 | ||||
-rw-r--r-- | drivers/dma/qcom/hidma_ll.c | 1 | ||||
-rw-r--r-- | drivers/dma/s3c24xx-dma.c | 18 | ||||
-rw-r--r-- | drivers/dma/sirf-dma.c | 1 | ||||
-rw-r--r-- | drivers/dma/txx9dmac.c | 9 |
23 files changed, 222 insertions, 23 deletions
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c index c1006165cea8..e4acd63e42aa 100644 --- a/drivers/dma/coh901318.c +++ b/drivers/dma/coh901318.c | |||
@@ -266,7 +266,7 @@ static int dma_memcpy_channels[] = { | |||
266 | COH901318_CX_CTRL_DDMA_LEGACY | \ | 266 | COH901318_CX_CTRL_DDMA_LEGACY | \ |
267 | COH901318_CX_CTRL_PRDD_SOURCE) | 267 | COH901318_CX_CTRL_PRDD_SOURCE) |
268 | 268 | ||
269 | const struct coh_dma_channel chan_config[U300_DMA_CHANNELS] = { | 269 | static const struct coh_dma_channel chan_config[U300_DMA_CHANNELS] = { |
270 | { | 270 | { |
271 | .number = U300_DMA_MSL_TX_0, | 271 | .number = U300_DMA_MSL_TX_0, |
272 | .name = "MSL TX 0", | 272 | .name = "MSL TX 0", |
@@ -1280,6 +1280,7 @@ struct coh901318_desc { | |||
1280 | struct coh901318_base { | 1280 | struct coh901318_base { |
1281 | struct device *dev; | 1281 | struct device *dev; |
1282 | void __iomem *virtbase; | 1282 | void __iomem *virtbase; |
1283 | unsigned int irq; | ||
1283 | struct coh901318_pool pool; | 1284 | struct coh901318_pool pool; |
1284 | struct powersave pm; | 1285 | struct powersave pm; |
1285 | struct dma_device dma_slave; | 1286 | struct dma_device dma_slave; |
@@ -1364,7 +1365,6 @@ static int coh901318_debugfs_read(struct file *file, char __user *buf, | |||
1364 | } | 1365 | } |
1365 | 1366 | ||
1366 | static const struct file_operations coh901318_debugfs_status_operations = { | 1367 | static const struct file_operations coh901318_debugfs_status_operations = { |
1367 | .owner = THIS_MODULE, | ||
1368 | .open = simple_open, | 1368 | .open = simple_open, |
1369 | .read = coh901318_debugfs_read, | 1369 | .read = coh901318_debugfs_read, |
1370 | .llseek = default_llseek, | 1370 | .llseek = default_llseek, |
@@ -2680,6 +2680,8 @@ static int __init coh901318_probe(struct platform_device *pdev) | |||
2680 | if (err) | 2680 | if (err) |
2681 | return err; | 2681 | return err; |
2682 | 2682 | ||
2683 | base->irq = irq; | ||
2684 | |||
2683 | err = coh901318_pool_create(&base->pool, &pdev->dev, | 2685 | err = coh901318_pool_create(&base->pool, &pdev->dev, |
2684 | sizeof(struct coh901318_lli), | 2686 | sizeof(struct coh901318_lli), |
2685 | 32); | 2687 | 32); |
@@ -2755,11 +2757,31 @@ static int __init coh901318_probe(struct platform_device *pdev) | |||
2755 | coh901318_pool_destroy(&base->pool); | 2757 | coh901318_pool_destroy(&base->pool); |
2756 | return err; | 2758 | return err; |
2757 | } | 2759 | } |
2760 | static void coh901318_base_remove(struct coh901318_base *base, const int *pick_chans) | ||
2761 | { | ||
2762 | int chans_i; | ||
2763 | int i = 0; | ||
2764 | struct coh901318_chan *cohc; | ||
2765 | |||
2766 | for (chans_i = 0; pick_chans[chans_i] != -1; chans_i += 2) { | ||
2767 | for (i = pick_chans[chans_i]; i <= pick_chans[chans_i+1]; i++) { | ||
2768 | cohc = &base->chans[i]; | ||
2769 | |||
2770 | tasklet_kill(&cohc->tasklet); | ||
2771 | } | ||
2772 | } | ||
2773 | |||
2774 | } | ||
2758 | 2775 | ||
2759 | static int coh901318_remove(struct platform_device *pdev) | 2776 | static int coh901318_remove(struct platform_device *pdev) |
2760 | { | 2777 | { |
2761 | struct coh901318_base *base = platform_get_drvdata(pdev); | 2778 | struct coh901318_base *base = platform_get_drvdata(pdev); |
2762 | 2779 | ||
2780 | devm_free_irq(&pdev->dev, base->irq, base); | ||
2781 | |||
2782 | coh901318_base_remove(base, dma_slave_channels); | ||
2783 | coh901318_base_remove(base, dma_memcpy_channels); | ||
2784 | |||
2763 | of_dma_controller_free(pdev->dev.of_node); | 2785 | of_dma_controller_free(pdev->dev.of_node); |
2764 | dma_async_device_unregister(&base->dma_memcpy); | 2786 | dma_async_device_unregister(&base->dma_memcpy); |
2765 | dma_async_device_unregister(&base->dma_slave); | 2787 | dma_async_device_unregister(&base->dma_slave); |
@@ -2780,13 +2802,13 @@ static struct platform_driver coh901318_driver = { | |||
2780 | }, | 2802 | }, |
2781 | }; | 2803 | }; |
2782 | 2804 | ||
2783 | int __init coh901318_init(void) | 2805 | static int __init coh901318_init(void) |
2784 | { | 2806 | { |
2785 | return platform_driver_probe(&coh901318_driver, coh901318_probe); | 2807 | return platform_driver_probe(&coh901318_driver, coh901318_probe); |
2786 | } | 2808 | } |
2787 | subsys_initcall(coh901318_init); | 2809 | subsys_initcall(coh901318_init); |
2788 | 2810 | ||
2789 | void __exit coh901318_exit(void) | 2811 | static void __exit coh901318_exit(void) |
2790 | { | 2812 | { |
2791 | platform_driver_unregister(&coh901318_driver); | 2813 | platform_driver_unregister(&coh901318_driver); |
2792 | } | 2814 | } |
diff --git a/drivers/dma/cppi41.c b/drivers/dma/cppi41.c index ceedafbd23e0..4b2317426c8e 100644 --- a/drivers/dma/cppi41.c +++ b/drivers/dma/cppi41.c | |||
@@ -497,16 +497,13 @@ static struct dma_async_tx_descriptor *cppi41_dma_prep_slave_sg( | |||
497 | struct cppi41_desc *d; | 497 | struct cppi41_desc *d; |
498 | struct scatterlist *sg; | 498 | struct scatterlist *sg; |
499 | unsigned int i; | 499 | unsigned int i; |
500 | unsigned int num; | ||
501 | 500 | ||
502 | num = 0; | ||
503 | d = c->desc; | 501 | d = c->desc; |
504 | for_each_sg(sgl, sg, sg_len, i) { | 502 | for_each_sg(sgl, sg, sg_len, i) { |
505 | u32 addr; | 503 | u32 addr; |
506 | u32 len; | 504 | u32 len; |
507 | 505 | ||
508 | /* We need to use more than one desc once musb supports sg */ | 506 | /* We need to use more than one desc once musb supports sg */ |
509 | BUG_ON(num > 0); | ||
510 | addr = lower_32_bits(sg_dma_address(sg)); | 507 | addr = lower_32_bits(sg_dma_address(sg)); |
511 | len = sg_dma_len(sg); | 508 | len = sg_dma_len(sg); |
512 | 509 | ||
diff --git a/drivers/dma/dma-jz4740.c b/drivers/dma/dma-jz4740.c index 7638b24ce8d0..9689b36c005a 100644 --- a/drivers/dma/dma-jz4740.c +++ b/drivers/dma/dma-jz4740.c | |||
@@ -573,12 +573,26 @@ err_unregister: | |||
573 | return ret; | 573 | return ret; |
574 | } | 574 | } |
575 | 575 | ||
576 | static void jz4740_cleanup_vchan(struct dma_device *dmadev) | ||
577 | { | ||
578 | struct jz4740_dmaengine_chan *chan, *_chan; | ||
579 | |||
580 | list_for_each_entry_safe(chan, _chan, | ||
581 | &dmadev->channels, vchan.chan.device_node) { | ||
582 | list_del(&chan->vchan.chan.device_node); | ||
583 | tasklet_kill(&chan->vchan.task); | ||
584 | } | ||
585 | } | ||
586 | |||
587 | |||
576 | static int jz4740_dma_remove(struct platform_device *pdev) | 588 | static int jz4740_dma_remove(struct platform_device *pdev) |
577 | { | 589 | { |
578 | struct jz4740_dma_dev *dmadev = platform_get_drvdata(pdev); | 590 | struct jz4740_dma_dev *dmadev = platform_get_drvdata(pdev); |
579 | int irq = platform_get_irq(pdev, 0); | 591 | int irq = platform_get_irq(pdev, 0); |
580 | 592 | ||
581 | free_irq(irq, dmadev); | 593 | free_irq(irq, dmadev); |
594 | |||
595 | jz4740_cleanup_vchan(&dmadev->ddev); | ||
582 | dma_async_device_unregister(&dmadev->ddev); | 596 | dma_async_device_unregister(&dmadev->ddev); |
583 | clk_disable_unprepare(dmadev->clk); | 597 | clk_disable_unprepare(dmadev->clk); |
584 | 598 | ||
diff --git a/drivers/dma/edma.c b/drivers/dma/edma.c index b95ef7482c52..3d277fa76c1a 100644 --- a/drivers/dma/edma.c +++ b/drivers/dma/edma.c | |||
@@ -239,6 +239,9 @@ struct edma_cc { | |||
239 | bool chmap_exist; | 239 | bool chmap_exist; |
240 | enum dma_event_q default_queue; | 240 | enum dma_event_q default_queue; |
241 | 241 | ||
242 | unsigned int ccint; | ||
243 | unsigned int ccerrint; | ||
244 | |||
242 | /* | 245 | /* |
243 | * The slot_inuse bit for each PaRAM slot is clear unless the slot is | 246 | * The slot_inuse bit for each PaRAM slot is clear unless the slot is |
244 | * in use by Linux or if it is allocated to be used by DSP. | 247 | * in use by Linux or if it is allocated to be used by DSP. |
@@ -2283,6 +2286,7 @@ static int edma_probe(struct platform_device *pdev) | |||
2283 | dev_err(dev, "CCINT (%d) failed --> %d\n", irq, ret); | 2286 | dev_err(dev, "CCINT (%d) failed --> %d\n", irq, ret); |
2284 | return ret; | 2287 | return ret; |
2285 | } | 2288 | } |
2289 | ecc->ccint = irq; | ||
2286 | } | 2290 | } |
2287 | 2291 | ||
2288 | irq = platform_get_irq_byname(pdev, "edma3_ccerrint"); | 2292 | irq = platform_get_irq_byname(pdev, "edma3_ccerrint"); |
@@ -2298,6 +2302,7 @@ static int edma_probe(struct platform_device *pdev) | |||
2298 | dev_err(dev, "CCERRINT (%d) failed --> %d\n", irq, ret); | 2302 | dev_err(dev, "CCERRINT (%d) failed --> %d\n", irq, ret); |
2299 | return ret; | 2303 | return ret; |
2300 | } | 2304 | } |
2305 | ecc->ccerrint = irq; | ||
2301 | } | 2306 | } |
2302 | 2307 | ||
2303 | ecc->dummy_slot = edma_alloc_slot(ecc, EDMA_SLOT_ANY); | 2308 | ecc->dummy_slot = edma_alloc_slot(ecc, EDMA_SLOT_ANY); |
@@ -2388,11 +2393,27 @@ err_reg1: | |||
2388 | return ret; | 2393 | return ret; |
2389 | } | 2394 | } |
2390 | 2395 | ||
2396 | static void edma_cleanupp_vchan(struct dma_device *dmadev) | ||
2397 | { | ||
2398 | struct edma_chan *echan, *_echan; | ||
2399 | |||
2400 | list_for_each_entry_safe(echan, _echan, | ||
2401 | &dmadev->channels, vchan.chan.device_node) { | ||
2402 | list_del(&echan->vchan.chan.device_node); | ||
2403 | tasklet_kill(&echan->vchan.task); | ||
2404 | } | ||
2405 | } | ||
2406 | |||
2391 | static int edma_remove(struct platform_device *pdev) | 2407 | static int edma_remove(struct platform_device *pdev) |
2392 | { | 2408 | { |
2393 | struct device *dev = &pdev->dev; | 2409 | struct device *dev = &pdev->dev; |
2394 | struct edma_cc *ecc = dev_get_drvdata(dev); | 2410 | struct edma_cc *ecc = dev_get_drvdata(dev); |
2395 | 2411 | ||
2412 | devm_free_irq(dev, ecc->ccint, ecc); | ||
2413 | devm_free_irq(dev, ecc->ccerrint, ecc); | ||
2414 | |||
2415 | edma_cleanupp_vchan(&ecc->dma_slave); | ||
2416 | |||
2396 | if (dev->of_node) | 2417 | if (dev->of_node) |
2397 | of_dma_controller_free(dev->of_node); | 2418 | of_dma_controller_free(dev->of_node); |
2398 | dma_async_device_unregister(&ecc->dma_slave); | 2419 | dma_async_device_unregister(&ecc->dma_slave); |
diff --git a/drivers/dma/fsl-edma.c b/drivers/dma/fsl-edma.c index cc06eeaef1a7..6775f2c74e25 100644 --- a/drivers/dma/fsl-edma.c +++ b/drivers/dma/fsl-edma.c | |||
@@ -852,6 +852,17 @@ fsl_edma_irq_init(struct platform_device *pdev, struct fsl_edma_engine *fsl_edma | |||
852 | return 0; | 852 | return 0; |
853 | } | 853 | } |
854 | 854 | ||
855 | static void fsl_edma_irq_exit( | ||
856 | struct platform_device *pdev, struct fsl_edma_engine *fsl_edma) | ||
857 | { | ||
858 | if (fsl_edma->txirq == fsl_edma->errirq) { | ||
859 | devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); | ||
860 | } else { | ||
861 | devm_free_irq(&pdev->dev, fsl_edma->txirq, fsl_edma); | ||
862 | devm_free_irq(&pdev->dev, fsl_edma->errirq, fsl_edma); | ||
863 | } | ||
864 | } | ||
865 | |||
855 | static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma) | 866 | static void fsl_disable_clocks(struct fsl_edma_engine *fsl_edma) |
856 | { | 867 | { |
857 | int i; | 868 | int i; |
@@ -984,11 +995,24 @@ static int fsl_edma_probe(struct platform_device *pdev) | |||
984 | return 0; | 995 | return 0; |
985 | } | 996 | } |
986 | 997 | ||
998 | static void fsl_edma_cleanup_vchan(struct dma_device *dmadev) | ||
999 | { | ||
1000 | struct fsl_edma_chan *chan, *_chan; | ||
1001 | |||
1002 | list_for_each_entry_safe(chan, _chan, | ||
1003 | &dmadev->channels, vchan.chan.device_node) { | ||
1004 | list_del(&chan->vchan.chan.device_node); | ||
1005 | tasklet_kill(&chan->vchan.task); | ||
1006 | } | ||
1007 | } | ||
1008 | |||
987 | static int fsl_edma_remove(struct platform_device *pdev) | 1009 | static int fsl_edma_remove(struct platform_device *pdev) |
988 | { | 1010 | { |
989 | struct device_node *np = pdev->dev.of_node; | 1011 | struct device_node *np = pdev->dev.of_node; |
990 | struct fsl_edma_engine *fsl_edma = platform_get_drvdata(pdev); | 1012 | struct fsl_edma_engine *fsl_edma = platform_get_drvdata(pdev); |
991 | 1013 | ||
1014 | fsl_edma_irq_exit(pdev, fsl_edma); | ||
1015 | fsl_edma_cleanup_vchan(&fsl_edma->dma_dev); | ||
992 | of_dma_controller_free(np); | 1016 | of_dma_controller_free(np); |
993 | dma_async_device_unregister(&fsl_edma->dma_dev); | 1017 | dma_async_device_unregister(&fsl_edma->dma_dev); |
994 | fsl_disable_clocks(fsl_edma); | 1018 | fsl_disable_clocks(fsl_edma); |
diff --git a/drivers/dma/fsl_raid.c b/drivers/dma/fsl_raid.c index 4d9470f16552..aad167eaaee8 100644 --- a/drivers/dma/fsl_raid.c +++ b/drivers/dma/fsl_raid.c | |||
@@ -337,7 +337,7 @@ static struct dma_async_tx_descriptor *fsl_re_prep_dma_genq( | |||
337 | 337 | ||
338 | re_chan = container_of(chan, struct fsl_re_chan, chan); | 338 | re_chan = container_of(chan, struct fsl_re_chan, chan); |
339 | if (len > FSL_RE_MAX_DATA_LEN) { | 339 | if (len > FSL_RE_MAX_DATA_LEN) { |
340 | dev_err(re_chan->dev, "genq tx length %lu, max length %d\n", | 340 | dev_err(re_chan->dev, "genq tx length %zu, max length %d\n", |
341 | len, FSL_RE_MAX_DATA_LEN); | 341 | len, FSL_RE_MAX_DATA_LEN); |
342 | return NULL; | 342 | return NULL; |
343 | } | 343 | } |
@@ -424,7 +424,7 @@ static struct dma_async_tx_descriptor *fsl_re_prep_dma_pq( | |||
424 | 424 | ||
425 | re_chan = container_of(chan, struct fsl_re_chan, chan); | 425 | re_chan = container_of(chan, struct fsl_re_chan, chan); |
426 | if (len > FSL_RE_MAX_DATA_LEN) { | 426 | if (len > FSL_RE_MAX_DATA_LEN) { |
427 | dev_err(re_chan->dev, "pq tx length is %lu, max length is %d\n", | 427 | dev_err(re_chan->dev, "pq tx length is %zu, max length is %d\n", |
428 | len, FSL_RE_MAX_DATA_LEN); | 428 | len, FSL_RE_MAX_DATA_LEN); |
429 | return NULL; | 429 | return NULL; |
430 | } | 430 | } |
@@ -545,7 +545,7 @@ static struct dma_async_tx_descriptor *fsl_re_prep_dma_memcpy( | |||
545 | re_chan = container_of(chan, struct fsl_re_chan, chan); | 545 | re_chan = container_of(chan, struct fsl_re_chan, chan); |
546 | 546 | ||
547 | if (len > FSL_RE_MAX_DATA_LEN) { | 547 | if (len > FSL_RE_MAX_DATA_LEN) { |
548 | dev_err(re_chan->dev, "cp tx length is %lu, max length is %d\n", | 548 | dev_err(re_chan->dev, "cp tx length is %zu, max length is %d\n", |
549 | len, FSL_RE_MAX_DATA_LEN); | 549 | len, FSL_RE_MAX_DATA_LEN); |
550 | return NULL; | 550 | return NULL; |
551 | } | 551 | } |
@@ -856,6 +856,8 @@ static int fsl_re_probe(struct platform_device *ofdev) | |||
856 | 856 | ||
857 | static void fsl_re_remove_chan(struct fsl_re_chan *chan) | 857 | static void fsl_re_remove_chan(struct fsl_re_chan *chan) |
858 | { | 858 | { |
859 | tasklet_kill(&chan->irqtask); | ||
860 | |||
859 | dma_pool_free(chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr, | 861 | dma_pool_free(chan->re_dev->hw_desc_pool, chan->inb_ring_virt_addr, |
860 | chan->inb_phys_addr); | 862 | chan->inb_phys_addr); |
861 | 863 | ||
@@ -890,7 +892,6 @@ static struct of_device_id fsl_re_ids[] = { | |||
890 | static struct platform_driver fsl_re_driver = { | 892 | static struct platform_driver fsl_re_driver = { |
891 | .driver = { | 893 | .driver = { |
892 | .name = "fsl-raideng", | 894 | .name = "fsl-raideng", |
893 | .owner = THIS_MODULE, | ||
894 | .of_match_table = fsl_re_ids, | 895 | .of_match_table = fsl_re_ids, |
895 | }, | 896 | }, |
896 | .probe = fsl_re_probe, | 897 | .probe = fsl_re_probe, |
diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 48d85f8b95fe..a960608c0a4d 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c | |||
@@ -167,6 +167,7 @@ struct imxdma_channel { | |||
167 | u32 ccr_to_device; | 167 | u32 ccr_to_device; |
168 | bool enabled_2d; | 168 | bool enabled_2d; |
169 | int slot_2d; | 169 | int slot_2d; |
170 | unsigned int irq; | ||
170 | }; | 171 | }; |
171 | 172 | ||
172 | enum imx_dma_type { | 173 | enum imx_dma_type { |
@@ -186,6 +187,9 @@ struct imxdma_engine { | |||
186 | struct imx_dma_2d_config slots_2d[IMX_DMA_2D_SLOTS]; | 187 | struct imx_dma_2d_config slots_2d[IMX_DMA_2D_SLOTS]; |
187 | struct imxdma_channel channel[IMX_DMA_CHANNELS]; | 188 | struct imxdma_channel channel[IMX_DMA_CHANNELS]; |
188 | enum imx_dma_type devtype; | 189 | enum imx_dma_type devtype; |
190 | unsigned int irq; | ||
191 | unsigned int irq_err; | ||
192 | |||
189 | }; | 193 | }; |
190 | 194 | ||
191 | struct imxdma_filter_data { | 195 | struct imxdma_filter_data { |
@@ -1048,7 +1052,7 @@ static struct dma_chan *imxdma_xlate(struct of_phandle_args *dma_spec, | |||
1048 | } | 1052 | } |
1049 | 1053 | ||
1050 | static int __init imxdma_probe(struct platform_device *pdev) | 1054 | static int __init imxdma_probe(struct platform_device *pdev) |
1051 | { | 1055 | { |
1052 | struct imxdma_engine *imxdma; | 1056 | struct imxdma_engine *imxdma; |
1053 | struct resource *res; | 1057 | struct resource *res; |
1054 | const struct of_device_id *of_id; | 1058 | const struct of_device_id *of_id; |
@@ -1100,6 +1104,7 @@ static int __init imxdma_probe(struct platform_device *pdev) | |||
1100 | dev_warn(imxdma->dev, "Can't register IRQ for DMA\n"); | 1104 | dev_warn(imxdma->dev, "Can't register IRQ for DMA\n"); |
1101 | goto disable_dma_ahb_clk; | 1105 | goto disable_dma_ahb_clk; |
1102 | } | 1106 | } |
1107 | imxdma->irq = irq; | ||
1103 | 1108 | ||
1104 | irq_err = platform_get_irq(pdev, 1); | 1109 | irq_err = platform_get_irq(pdev, 1); |
1105 | if (irq_err < 0) { | 1110 | if (irq_err < 0) { |
@@ -1113,6 +1118,7 @@ static int __init imxdma_probe(struct platform_device *pdev) | |||
1113 | dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n"); | 1118 | dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n"); |
1114 | goto disable_dma_ahb_clk; | 1119 | goto disable_dma_ahb_clk; |
1115 | } | 1120 | } |
1121 | imxdma->irq_err = irq_err; | ||
1116 | } | 1122 | } |
1117 | 1123 | ||
1118 | /* enable DMA module */ | 1124 | /* enable DMA module */ |
@@ -1150,6 +1156,8 @@ static int __init imxdma_probe(struct platform_device *pdev) | |||
1150 | irq + i, i); | 1156 | irq + i, i); |
1151 | goto disable_dma_ahb_clk; | 1157 | goto disable_dma_ahb_clk; |
1152 | } | 1158 | } |
1159 | |||
1160 | imxdmac->irq = irq + i; | ||
1153 | init_timer(&imxdmac->watchdog); | 1161 | init_timer(&imxdmac->watchdog); |
1154 | imxdmac->watchdog.function = &imxdma_watchdog; | 1162 | imxdmac->watchdog.function = &imxdma_watchdog; |
1155 | imxdmac->watchdog.data = (unsigned long)imxdmac; | 1163 | imxdmac->watchdog.data = (unsigned long)imxdmac; |
@@ -1217,10 +1225,31 @@ disable_dma_ipg_clk: | |||
1217 | return ret; | 1225 | return ret; |
1218 | } | 1226 | } |
1219 | 1227 | ||
1228 | static void imxdma_free_irq(struct platform_device *pdev, struct imxdma_engine *imxdma) | ||
1229 | { | ||
1230 | int i; | ||
1231 | |||
1232 | if (is_imx1_dma(imxdma)) { | ||
1233 | disable_irq(imxdma->irq); | ||
1234 | disable_irq(imxdma->irq_err); | ||
1235 | } | ||
1236 | |||
1237 | for (i = 0; i < IMX_DMA_CHANNELS; i++) { | ||
1238 | struct imxdma_channel *imxdmac = &imxdma->channel[i]; | ||
1239 | |||
1240 | if (!is_imx1_dma(imxdma)) | ||
1241 | disable_irq(imxdmac->irq); | ||
1242 | |||
1243 | tasklet_kill(&imxdmac->dma_tasklet); | ||
1244 | } | ||
1245 | } | ||
1246 | |||
1220 | static int imxdma_remove(struct platform_device *pdev) | 1247 | static int imxdma_remove(struct platform_device *pdev) |
1221 | { | 1248 | { |
1222 | struct imxdma_engine *imxdma = platform_get_drvdata(pdev); | 1249 | struct imxdma_engine *imxdma = platform_get_drvdata(pdev); |
1223 | 1250 | ||
1251 | imxdma_free_irq(pdev, imxdma); | ||
1252 | |||
1224 | dma_async_device_unregister(&imxdma->dma_device); | 1253 | dma_async_device_unregister(&imxdma->dma_device); |
1225 | 1254 | ||
1226 | if (pdev->dev.of_node) | 1255 | if (pdev->dev.of_node) |
diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index ce865f68a8c7..03ec76fc22ff 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c | |||
@@ -386,6 +386,7 @@ struct sdma_engine { | |||
386 | const struct sdma_driver_data *drvdata; | 386 | const struct sdma_driver_data *drvdata; |
387 | u32 spba_start_addr; | 387 | u32 spba_start_addr; |
388 | u32 spba_end_addr; | 388 | u32 spba_end_addr; |
389 | unsigned int irq; | ||
389 | }; | 390 | }; |
390 | 391 | ||
391 | static struct sdma_driver_data sdma_imx31 = { | 392 | static struct sdma_driver_data sdma_imx31 = { |
@@ -751,7 +752,7 @@ static void sdma_get_pc(struct sdma_channel *sdmac, | |||
751 | * These are needed once we start to support transfers between | 752 | * These are needed once we start to support transfers between |
752 | * two peripherals or memory-to-memory transfers | 753 | * two peripherals or memory-to-memory transfers |
753 | */ | 754 | */ |
754 | int per_2_per = 0, emi_2_emi = 0; | 755 | int per_2_per = 0; |
755 | 756 | ||
756 | sdmac->pc_from_device = 0; | 757 | sdmac->pc_from_device = 0; |
757 | sdmac->pc_to_device = 0; | 758 | sdmac->pc_to_device = 0; |
@@ -759,7 +760,6 @@ static void sdma_get_pc(struct sdma_channel *sdmac, | |||
759 | 760 | ||
760 | switch (peripheral_type) { | 761 | switch (peripheral_type) { |
761 | case IMX_DMATYPE_MEMORY: | 762 | case IMX_DMATYPE_MEMORY: |
762 | emi_2_emi = sdma->script_addrs->ap_2_ap_addr; | ||
763 | break; | 763 | break; |
764 | case IMX_DMATYPE_DSP: | 764 | case IMX_DMATYPE_DSP: |
765 | emi_2_per = sdma->script_addrs->bp_2_ap_addr; | 765 | emi_2_per = sdma->script_addrs->bp_2_ap_addr; |
@@ -992,8 +992,6 @@ static int sdma_config_channel(struct dma_chan *chan) | |||
992 | } else | 992 | } else |
993 | __set_bit(sdmac->event_id0, sdmac->event_mask); | 993 | __set_bit(sdmac->event_id0, sdmac->event_mask); |
994 | 994 | ||
995 | /* Watermark Level */ | ||
996 | sdmac->watermark_level |= sdmac->watermark_level; | ||
997 | /* Address */ | 995 | /* Address */ |
998 | sdmac->shp_addr = sdmac->per_address; | 996 | sdmac->shp_addr = sdmac->per_address; |
999 | sdmac->per_addr = sdmac->per_address2; | 997 | sdmac->per_addr = sdmac->per_address2; |
@@ -1708,6 +1706,8 @@ static int sdma_probe(struct platform_device *pdev) | |||
1708 | if (ret) | 1706 | if (ret) |
1709 | return ret; | 1707 | return ret; |
1710 | 1708 | ||
1709 | sdma->irq = irq; | ||
1710 | |||
1711 | sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL); | 1711 | sdma->script_addrs = kzalloc(sizeof(*sdma->script_addrs), GFP_KERNEL); |
1712 | if (!sdma->script_addrs) | 1712 | if (!sdma->script_addrs) |
1713 | return -ENOMEM; | 1713 | return -ENOMEM; |
@@ -1833,6 +1833,7 @@ static int sdma_remove(struct platform_device *pdev) | |||
1833 | struct sdma_engine *sdma = platform_get_drvdata(pdev); | 1833 | struct sdma_engine *sdma = platform_get_drvdata(pdev); |
1834 | int i; | 1834 | int i; |
1835 | 1835 | ||
1836 | devm_free_irq(&pdev->dev, sdma->irq, sdma); | ||
1836 | dma_async_device_unregister(&sdma->dma_device); | 1837 | dma_async_device_unregister(&sdma->dma_device); |
1837 | kfree(sdma->script_addrs); | 1838 | kfree(sdma->script_addrs); |
1838 | /* Kill the tasklet */ | 1839 | /* Kill the tasklet */ |
diff --git a/drivers/dma/ioat/init.c b/drivers/dma/ioat/init.c index d406056e8892..7145f7716a92 100644 --- a/drivers/dma/ioat/init.c +++ b/drivers/dma/ioat/init.c | |||
@@ -1212,7 +1212,7 @@ static void ioat_shutdown(struct pci_dev *pdev) | |||
1212 | ioat_disable_interrupts(ioat_dma); | 1212 | ioat_disable_interrupts(ioat_dma); |
1213 | } | 1213 | } |
1214 | 1214 | ||
1215 | void ioat_resume(struct ioatdma_device *ioat_dma) | 1215 | static void ioat_resume(struct ioatdma_device *ioat_dma) |
1216 | { | 1216 | { |
1217 | struct ioatdma_chan *ioat_chan; | 1217 | struct ioatdma_chan *ioat_chan; |
1218 | u32 chanerr; | 1218 | u32 chanerr; |
diff --git a/drivers/dma/k3dma.c b/drivers/dma/k3dma.c index 563affd5cd06..39de8980128c 100644 --- a/drivers/dma/k3dma.c +++ b/drivers/dma/k3dma.c | |||
@@ -102,6 +102,7 @@ struct k3_dma_dev { | |||
102 | struct clk *clk; | 102 | struct clk *clk; |
103 | u32 dma_channels; | 103 | u32 dma_channels; |
104 | u32 dma_requests; | 104 | u32 dma_requests; |
105 | unsigned int irq; | ||
105 | }; | 106 | }; |
106 | 107 | ||
107 | #define to_k3_dma(dmadev) container_of(dmadev, struct k3_dma_dev, slave) | 108 | #define to_k3_dma(dmadev) container_of(dmadev, struct k3_dma_dev, slave) |
@@ -703,6 +704,8 @@ static int k3_dma_probe(struct platform_device *op) | |||
703 | if (ret) | 704 | if (ret) |
704 | return ret; | 705 | return ret; |
705 | 706 | ||
707 | d->irq = irq; | ||
708 | |||
706 | /* init phy channel */ | 709 | /* init phy channel */ |
707 | d->phy = devm_kzalloc(&op->dev, | 710 | d->phy = devm_kzalloc(&op->dev, |
708 | d->dma_channels * sizeof(struct k3_dma_phy), GFP_KERNEL); | 711 | d->dma_channels * sizeof(struct k3_dma_phy), GFP_KERNEL); |
@@ -787,6 +790,8 @@ static int k3_dma_remove(struct platform_device *op) | |||
787 | dma_async_device_unregister(&d->slave); | 790 | dma_async_device_unregister(&d->slave); |
788 | of_dma_controller_free((&op->dev)->of_node); | 791 | of_dma_controller_free((&op->dev)->of_node); |
789 | 792 | ||
793 | devm_free_irq(&op->dev, d->irq, d); | ||
794 | |||
790 | list_for_each_entry_safe(c, cn, &d->slave.channels, vc.chan.device_node) { | 795 | list_for_each_entry_safe(c, cn, &d->slave.channels, vc.chan.device_node) { |
791 | list_del(&c->vc.chan.device_node); | 796 | list_del(&c->vc.chan.device_node); |
792 | tasklet_kill(&c->vc.task); | 797 | tasklet_kill(&c->vc.task); |
diff --git a/drivers/dma/mmp_pdma.c b/drivers/dma/mmp_pdma.c index 56f1fd68b620..f4b25fb0d040 100644 --- a/drivers/dma/mmp_pdma.c +++ b/drivers/dma/mmp_pdma.c | |||
@@ -931,6 +931,25 @@ static void dma_do_tasklet(unsigned long data) | |||
931 | static int mmp_pdma_remove(struct platform_device *op) | 931 | static int mmp_pdma_remove(struct platform_device *op) |
932 | { | 932 | { |
933 | struct mmp_pdma_device *pdev = platform_get_drvdata(op); | 933 | struct mmp_pdma_device *pdev = platform_get_drvdata(op); |
934 | struct mmp_pdma_phy *phy; | ||
935 | int i, irq = 0, irq_num = 0; | ||
936 | |||
937 | |||
938 | for (i = 0; i < pdev->dma_channels; i++) { | ||
939 | if (platform_get_irq(op, i) > 0) | ||
940 | irq_num++; | ||
941 | } | ||
942 | |||
943 | if (irq_num != pdev->dma_channels) { | ||
944 | irq = platform_get_irq(op, 0); | ||
945 | devm_free_irq(&op->dev, irq, pdev); | ||
946 | } else { | ||
947 | for (i = 0; i < pdev->dma_channels; i++) { | ||
948 | phy = &pdev->phy[i]; | ||
949 | irq = platform_get_irq(op, i); | ||
950 | devm_free_irq(&op->dev, irq, phy); | ||
951 | } | ||
952 | } | ||
934 | 953 | ||
935 | dma_async_device_unregister(&pdev->device); | 954 | dma_async_device_unregister(&pdev->device); |
936 | return 0; | 955 | return 0; |
diff --git a/drivers/dma/mmp_tdma.c b/drivers/dma/mmp_tdma.c index ba7f412696c9..b3441f57a364 100644 --- a/drivers/dma/mmp_tdma.c +++ b/drivers/dma/mmp_tdma.c | |||
@@ -404,7 +404,7 @@ static void mmp_tdma_free_chan_resources(struct dma_chan *chan) | |||
404 | return; | 404 | return; |
405 | } | 405 | } |
406 | 406 | ||
407 | struct mmp_tdma_desc *mmp_tdma_alloc_descriptor(struct mmp_tdma_chan *tdmac) | 407 | static struct mmp_tdma_desc *mmp_tdma_alloc_descriptor(struct mmp_tdma_chan *tdmac) |
408 | { | 408 | { |
409 | struct gen_pool *gpool; | 409 | struct gen_pool *gpool; |
410 | int size = tdmac->desc_num * sizeof(struct mmp_tdma_desc); | 410 | int size = tdmac->desc_num * sizeof(struct mmp_tdma_desc); |
@@ -592,7 +592,7 @@ static bool mmp_tdma_filter_fn(struct dma_chan *chan, void *fn_param) | |||
592 | return true; | 592 | return true; |
593 | } | 593 | } |
594 | 594 | ||
595 | struct dma_chan *mmp_tdma_xlate(struct of_phandle_args *dma_spec, | 595 | static struct dma_chan *mmp_tdma_xlate(struct of_phandle_args *dma_spec, |
596 | struct of_dma *ofdma) | 596 | struct of_dma *ofdma) |
597 | { | 597 | { |
598 | struct mmp_tdma_device *tdev = ofdma->of_dma_data; | 598 | struct mmp_tdma_device *tdev = ofdma->of_dma_data; |
diff --git a/drivers/dma/moxart-dma.c b/drivers/dma/moxart-dma.c index b3a1d9a22b61..a6e642792e5a 100644 --- a/drivers/dma/moxart-dma.c +++ b/drivers/dma/moxart-dma.c | |||
@@ -148,6 +148,7 @@ struct moxart_chan { | |||
148 | struct moxart_dmadev { | 148 | struct moxart_dmadev { |
149 | struct dma_device dma_slave; | 149 | struct dma_device dma_slave; |
150 | struct moxart_chan slave_chans[APB_DMA_MAX_CHANNEL]; | 150 | struct moxart_chan slave_chans[APB_DMA_MAX_CHANNEL]; |
151 | unsigned int irq; | ||
151 | }; | 152 | }; |
152 | 153 | ||
153 | struct moxart_filter_data { | 154 | struct moxart_filter_data { |
@@ -615,6 +616,7 @@ static int moxart_probe(struct platform_device *pdev) | |||
615 | dev_err(dev, "devm_request_irq failed\n"); | 616 | dev_err(dev, "devm_request_irq failed\n"); |
616 | return ret; | 617 | return ret; |
617 | } | 618 | } |
619 | mdc->irq = irq; | ||
618 | 620 | ||
619 | ret = dma_async_device_register(&mdc->dma_slave); | 621 | ret = dma_async_device_register(&mdc->dma_slave); |
620 | if (ret) { | 622 | if (ret) { |
@@ -638,6 +640,8 @@ static int moxart_remove(struct platform_device *pdev) | |||
638 | { | 640 | { |
639 | struct moxart_dmadev *m = platform_get_drvdata(pdev); | 641 | struct moxart_dmadev *m = platform_get_drvdata(pdev); |
640 | 642 | ||
643 | devm_free_irq(&pdev->dev, m->irq, m); | ||
644 | |||
641 | dma_async_device_unregister(&m->dma_slave); | 645 | dma_async_device_unregister(&m->dma_slave); |
642 | 646 | ||
643 | if (pdev->dev.of_node) | 647 | if (pdev->dev.of_node) |
diff --git a/drivers/dma/mpc512x_dma.c b/drivers/dma/mpc512x_dma.c index ccadafa51d5e..fa86592c7ae1 100644 --- a/drivers/dma/mpc512x_dma.c +++ b/drivers/dma/mpc512x_dma.c | |||
@@ -1110,6 +1110,7 @@ static int mpc_dma_remove(struct platform_device *op) | |||
1110 | } | 1110 | } |
1111 | free_irq(mdma->irq, mdma); | 1111 | free_irq(mdma->irq, mdma); |
1112 | irq_dispose_mapping(mdma->irq); | 1112 | irq_dispose_mapping(mdma->irq); |
1113 | tasklet_kill(&mdma->tasklet); | ||
1113 | 1114 | ||
1114 | return 0; | 1115 | return 0; |
1115 | } | 1116 | } |
diff --git a/drivers/dma/nbpfaxi.c b/drivers/dma/nbpfaxi.c index 9f0e98b75eb9..08c45c185549 100644 --- a/drivers/dma/nbpfaxi.c +++ b/drivers/dma/nbpfaxi.c | |||
@@ -227,6 +227,7 @@ struct nbpf_device { | |||
227 | void __iomem *base; | 227 | void __iomem *base; |
228 | struct clk *clk; | 228 | struct clk *clk; |
229 | const struct nbpf_config *config; | 229 | const struct nbpf_config *config; |
230 | unsigned int eirq; | ||
230 | struct nbpf_channel chan[]; | 231 | struct nbpf_channel chan[]; |
231 | }; | 232 | }; |
232 | 233 | ||
@@ -1375,6 +1376,7 @@ static int nbpf_probe(struct platform_device *pdev) | |||
1375 | IRQF_SHARED, "dma error", nbpf); | 1376 | IRQF_SHARED, "dma error", nbpf); |
1376 | if (ret < 0) | 1377 | if (ret < 0) |
1377 | return ret; | 1378 | return ret; |
1379 | nbpf->eirq = eirq; | ||
1378 | 1380 | ||
1379 | INIT_LIST_HEAD(&dma_dev->channels); | 1381 | INIT_LIST_HEAD(&dma_dev->channels); |
1380 | 1382 | ||
@@ -1446,6 +1448,17 @@ e_clk_off: | |||
1446 | static int nbpf_remove(struct platform_device *pdev) | 1448 | static int nbpf_remove(struct platform_device *pdev) |
1447 | { | 1449 | { |
1448 | struct nbpf_device *nbpf = platform_get_drvdata(pdev); | 1450 | struct nbpf_device *nbpf = platform_get_drvdata(pdev); |
1451 | int i; | ||
1452 | |||
1453 | devm_free_irq(&pdev->dev, nbpf->eirq, nbpf); | ||
1454 | |||
1455 | for (i = 0; i < nbpf->config->num_channels; i++) { | ||
1456 | struct nbpf_channel *chan = nbpf->chan + i; | ||
1457 | |||
1458 | devm_free_irq(&pdev->dev, chan->irq, chan); | ||
1459 | |||
1460 | tasklet_kill(&chan->tasklet); | ||
1461 | } | ||
1449 | 1462 | ||
1450 | of_dma_controller_free(pdev->dev.of_node); | 1463 | of_dma_controller_free(pdev->dev.of_node); |
1451 | dma_async_device_unregister(&nbpf->dma_dev); | 1464 | dma_async_device_unregister(&nbpf->dma_dev); |
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c index 2e0d49bcfd8a..d99ca2b511c4 100644 --- a/drivers/dma/omap-dma.c +++ b/drivers/dma/omap-dma.c | |||
@@ -1292,10 +1292,14 @@ static int omap_dma_probe(struct platform_device *pdev) | |||
1292 | static int omap_dma_remove(struct platform_device *pdev) | 1292 | static int omap_dma_remove(struct platform_device *pdev) |
1293 | { | 1293 | { |
1294 | struct omap_dmadev *od = platform_get_drvdata(pdev); | 1294 | struct omap_dmadev *od = platform_get_drvdata(pdev); |
1295 | int irq; | ||
1295 | 1296 | ||
1296 | if (pdev->dev.of_node) | 1297 | if (pdev->dev.of_node) |
1297 | of_dma_controller_free(pdev->dev.of_node); | 1298 | of_dma_controller_free(pdev->dev.of_node); |
1298 | 1299 | ||
1300 | irq = platform_get_irq(pdev, 1); | ||
1301 | devm_free_irq(&pdev->dev, irq, od); | ||
1302 | |||
1299 | dma_async_device_unregister(&od->ddev); | 1303 | dma_async_device_unregister(&od->ddev); |
1300 | 1304 | ||
1301 | if (!od->legacy) { | 1305 | if (!od->legacy) { |
diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c index c8767d3e5eb0..4fc3ffbd5ca0 100644 --- a/drivers/dma/pl330.c +++ b/drivers/dma/pl330.c | |||
@@ -3002,12 +3002,18 @@ static int pl330_remove(struct amba_device *adev) | |||
3002 | { | 3002 | { |
3003 | struct pl330_dmac *pl330 = amba_get_drvdata(adev); | 3003 | struct pl330_dmac *pl330 = amba_get_drvdata(adev); |
3004 | struct dma_pl330_chan *pch, *_p; | 3004 | struct dma_pl330_chan *pch, *_p; |
3005 | int i, irq; | ||
3005 | 3006 | ||
3006 | pm_runtime_get_noresume(pl330->ddma.dev); | 3007 | pm_runtime_get_noresume(pl330->ddma.dev); |
3007 | 3008 | ||
3008 | if (adev->dev.of_node) | 3009 | if (adev->dev.of_node) |
3009 | of_dma_controller_free(adev->dev.of_node); | 3010 | of_dma_controller_free(adev->dev.of_node); |
3010 | 3011 | ||
3012 | for (i = 0; i < AMBA_NR_IRQS; i++) { | ||
3013 | irq = adev->irq[i]; | ||
3014 | devm_free_irq(&adev->dev, irq, pl330); | ||
3015 | } | ||
3016 | |||
3011 | dma_async_device_unregister(&pl330->ddma); | 3017 | dma_async_device_unregister(&pl330->ddma); |
3012 | 3018 | ||
3013 | /* Idle the DMAC */ | 3019 | /* Idle the DMAC */ |
diff --git a/drivers/dma/pxa_dma.c b/drivers/dma/pxa_dma.c index e756a30ccba2..dc7850a422b8 100644 --- a/drivers/dma/pxa_dma.c +++ b/drivers/dma/pxa_dma.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/of_device.h> | 21 | #include <linux/of_device.h> |
22 | #include <linux/of_dma.h> | 22 | #include <linux/of_dma.h> |
23 | #include <linux/of.h> | 23 | #include <linux/of.h> |
24 | #include <linux/wait.h> | ||
24 | #include <linux/dma/pxa-dma.h> | 25 | #include <linux/dma/pxa-dma.h> |
25 | 26 | ||
26 | #include "dmaengine.h" | 27 | #include "dmaengine.h" |
@@ -118,6 +119,8 @@ struct pxad_chan { | |||
118 | struct pxad_phy *phy; | 119 | struct pxad_phy *phy; |
119 | struct dma_pool *desc_pool; /* Descriptors pool */ | 120 | struct dma_pool *desc_pool; /* Descriptors pool */ |
120 | dma_cookie_t bus_error; | 121 | dma_cookie_t bus_error; |
122 | |||
123 | wait_queue_head_t wq_state; | ||
121 | }; | 124 | }; |
122 | 125 | ||
123 | struct pxad_device { | 126 | struct pxad_device { |
@@ -318,7 +321,6 @@ static int dbg_open_##name(struct inode *inode, struct file *file) \ | |||
318 | return single_open(file, dbg_show_##name, inode->i_private); \ | 321 | return single_open(file, dbg_show_##name, inode->i_private); \ |
319 | } \ | 322 | } \ |
320 | static const struct file_operations dbg_fops_##name = { \ | 323 | static const struct file_operations dbg_fops_##name = { \ |
321 | .owner = THIS_MODULE, \ | ||
322 | .open = dbg_open_##name, \ | 324 | .open = dbg_open_##name, \ |
323 | .llseek = seq_lseek, \ | 325 | .llseek = seq_lseek, \ |
324 | .read = seq_read, \ | 326 | .read = seq_read, \ |
@@ -572,6 +574,7 @@ static void pxad_launch_chan(struct pxad_chan *chan, | |||
572 | */ | 574 | */ |
573 | phy_writel(chan->phy, desc->first, DDADR); | 575 | phy_writel(chan->phy, desc->first, DDADR); |
574 | phy_enable(chan->phy, chan->misaligned); | 576 | phy_enable(chan->phy, chan->misaligned); |
577 | wake_up(&chan->wq_state); | ||
575 | } | 578 | } |
576 | 579 | ||
577 | static void set_updater_desc(struct pxad_desc_sw *sw_desc, | 580 | static void set_updater_desc(struct pxad_desc_sw *sw_desc, |
@@ -717,6 +720,7 @@ static irqreturn_t pxad_chan_handler(int irq, void *dev_id) | |||
717 | } | 720 | } |
718 | } | 721 | } |
719 | spin_unlock_irqrestore(&chan->vc.lock, flags); | 722 | spin_unlock_irqrestore(&chan->vc.lock, flags); |
723 | wake_up(&chan->wq_state); | ||
720 | 724 | ||
721 | return IRQ_HANDLED; | 725 | return IRQ_HANDLED; |
722 | } | 726 | } |
@@ -1268,6 +1272,14 @@ static enum dma_status pxad_tx_status(struct dma_chan *dchan, | |||
1268 | return ret; | 1272 | return ret; |
1269 | } | 1273 | } |
1270 | 1274 | ||
1275 | static void pxad_synchronize(struct dma_chan *dchan) | ||
1276 | { | ||
1277 | struct pxad_chan *chan = to_pxad_chan(dchan); | ||
1278 | |||
1279 | wait_event(chan->wq_state, !is_chan_running(chan)); | ||
1280 | vchan_synchronize(&chan->vc); | ||
1281 | } | ||
1282 | |||
1271 | static void pxad_free_channels(struct dma_device *dmadev) | 1283 | static void pxad_free_channels(struct dma_device *dmadev) |
1272 | { | 1284 | { |
1273 | struct pxad_chan *c, *cn; | 1285 | struct pxad_chan *c, *cn; |
@@ -1372,6 +1384,7 @@ static int pxad_init_dmadev(struct platform_device *op, | |||
1372 | pdev->slave.device_tx_status = pxad_tx_status; | 1384 | pdev->slave.device_tx_status = pxad_tx_status; |
1373 | pdev->slave.device_issue_pending = pxad_issue_pending; | 1385 | pdev->slave.device_issue_pending = pxad_issue_pending; |
1374 | pdev->slave.device_config = pxad_config; | 1386 | pdev->slave.device_config = pxad_config; |
1387 | pdev->slave.device_synchronize = pxad_synchronize; | ||
1375 | pdev->slave.device_terminate_all = pxad_terminate_all; | 1388 | pdev->slave.device_terminate_all = pxad_terminate_all; |
1376 | 1389 | ||
1377 | if (op->dev.coherent_dma_mask) | 1390 | if (op->dev.coherent_dma_mask) |
@@ -1389,6 +1402,7 @@ static int pxad_init_dmadev(struct platform_device *op, | |||
1389 | return -ENOMEM; | 1402 | return -ENOMEM; |
1390 | c->vc.desc_free = pxad_free_desc; | 1403 | c->vc.desc_free = pxad_free_desc; |
1391 | vchan_init(&c->vc, &pdev->slave); | 1404 | vchan_init(&c->vc, &pdev->slave); |
1405 | init_waitqueue_head(&c->wq_state); | ||
1392 | } | 1406 | } |
1393 | 1407 | ||
1394 | return dma_async_device_register(&pdev->slave); | 1408 | return dma_async_device_register(&pdev->slave); |
diff --git a/drivers/dma/qcom/hidma.c b/drivers/dma/qcom/hidma.c index 41b5c6dee713..b2374cd91e45 100644 --- a/drivers/dma/qcom/hidma.c +++ b/drivers/dma/qcom/hidma.c | |||
@@ -708,6 +708,7 @@ static int hidma_remove(struct platform_device *pdev) | |||
708 | pm_runtime_get_sync(dmadev->ddev.dev); | 708 | pm_runtime_get_sync(dmadev->ddev.dev); |
709 | dma_async_device_unregister(&dmadev->ddev); | 709 | dma_async_device_unregister(&dmadev->ddev); |
710 | devm_free_irq(dmadev->ddev.dev, dmadev->irq, dmadev->lldev); | 710 | devm_free_irq(dmadev->ddev.dev, dmadev->irq, dmadev->lldev); |
711 | tasklet_kill(&dmadev->task); | ||
711 | hidma_debug_uninit(dmadev); | 712 | hidma_debug_uninit(dmadev); |
712 | hidma_ll_uninit(dmadev->lldev); | 713 | hidma_ll_uninit(dmadev->lldev); |
713 | hidma_free(dmadev); | 714 | hidma_free(dmadev); |
diff --git a/drivers/dma/qcom/hidma_ll.c b/drivers/dma/qcom/hidma_ll.c index f3929001539b..ad20dfb64c71 100644 --- a/drivers/dma/qcom/hidma_ll.c +++ b/drivers/dma/qcom/hidma_ll.c | |||
@@ -831,6 +831,7 @@ int hidma_ll_uninit(struct hidma_lldev *lldev) | |||
831 | 831 | ||
832 | required_bytes = sizeof(struct hidma_tre) * lldev->nr_tres; | 832 | required_bytes = sizeof(struct hidma_tre) * lldev->nr_tres; |
833 | tasklet_kill(&lldev->task); | 833 | tasklet_kill(&lldev->task); |
834 | tasklet_kill(&lldev->rst_task); | ||
834 | memset(lldev->trepool, 0, required_bytes); | 835 | memset(lldev->trepool, 0, required_bytes); |
835 | lldev->trepool = NULL; | 836 | lldev->trepool = NULL; |
836 | lldev->pending_tre_count = 0; | 837 | lldev->pending_tre_count = 0; |
diff --git a/drivers/dma/s3c24xx-dma.c b/drivers/dma/s3c24xx-dma.c index 0d2d187646f4..ce67075589f5 100644 --- a/drivers/dma/s3c24xx-dma.c +++ b/drivers/dma/s3c24xx-dma.c | |||
@@ -1136,8 +1136,10 @@ static void s3c24xx_dma_free_virtual_channels(struct dma_device *dmadev) | |||
1136 | struct s3c24xx_dma_chan *next; | 1136 | struct s3c24xx_dma_chan *next; |
1137 | 1137 | ||
1138 | list_for_each_entry_safe(chan, | 1138 | list_for_each_entry_safe(chan, |
1139 | next, &dmadev->channels, vc.chan.device_node) | 1139 | next, &dmadev->channels, vc.chan.device_node) { |
1140 | list_del(&chan->vc.chan.device_node); | 1140 | list_del(&chan->vc.chan.device_node); |
1141 | tasklet_kill(&chan->vc.task); | ||
1142 | } | ||
1141 | } | 1143 | } |
1142 | 1144 | ||
1143 | /* s3c2410, s3c2440 and s3c2442 have a 0x40 stride without separate clocks */ | 1145 | /* s3c2410, s3c2440 and s3c2442 have a 0x40 stride without separate clocks */ |
@@ -1359,6 +1361,18 @@ err_memcpy: | |||
1359 | return ret; | 1361 | return ret; |
1360 | } | 1362 | } |
1361 | 1363 | ||
1364 | static void s3c24xx_dma_free_irq(struct platform_device *pdev, | ||
1365 | struct s3c24xx_dma_engine *s3cdma) | ||
1366 | { | ||
1367 | int i; | ||
1368 | |||
1369 | for (i = 0; i < s3cdma->pdata->num_phy_channels; i++) { | ||
1370 | struct s3c24xx_dma_phy *phy = &s3cdma->phy_chans[i]; | ||
1371 | |||
1372 | devm_free_irq(&pdev->dev, phy->irq, phy); | ||
1373 | } | ||
1374 | } | ||
1375 | |||
1362 | static int s3c24xx_dma_remove(struct platform_device *pdev) | 1376 | static int s3c24xx_dma_remove(struct platform_device *pdev) |
1363 | { | 1377 | { |
1364 | const struct s3c24xx_dma_platdata *pdata = dev_get_platdata(&pdev->dev); | 1378 | const struct s3c24xx_dma_platdata *pdata = dev_get_platdata(&pdev->dev); |
@@ -1369,6 +1383,8 @@ static int s3c24xx_dma_remove(struct platform_device *pdev) | |||
1369 | dma_async_device_unregister(&s3cdma->slave); | 1383 | dma_async_device_unregister(&s3cdma->slave); |
1370 | dma_async_device_unregister(&s3cdma->memcpy); | 1384 | dma_async_device_unregister(&s3cdma->memcpy); |
1371 | 1385 | ||
1386 | s3c24xx_dma_free_irq(pdev, s3cdma); | ||
1387 | |||
1372 | s3c24xx_dma_free_virtual_channels(&s3cdma->slave); | 1388 | s3c24xx_dma_free_virtual_channels(&s3cdma->slave); |
1373 | s3c24xx_dma_free_virtual_channels(&s3cdma->memcpy); | 1389 | s3c24xx_dma_free_virtual_channels(&s3cdma->memcpy); |
1374 | 1390 | ||
diff --git a/drivers/dma/sirf-dma.c b/drivers/dma/sirf-dma.c index 906877919cf3..d8bc3f2a71db 100644 --- a/drivers/dma/sirf-dma.c +++ b/drivers/dma/sirf-dma.c | |||
@@ -980,6 +980,7 @@ static int sirfsoc_dma_remove(struct platform_device *op) | |||
980 | of_dma_controller_free(op->dev.of_node); | 980 | of_dma_controller_free(op->dev.of_node); |
981 | dma_async_device_unregister(&sdma->dma); | 981 | dma_async_device_unregister(&sdma->dma); |
982 | free_irq(sdma->irq, sdma); | 982 | free_irq(sdma->irq, sdma); |
983 | tasklet_kill(&sdma->tasklet); | ||
983 | irq_dispose_mapping(sdma->irq); | 984 | irq_dispose_mapping(sdma->irq); |
984 | pm_runtime_disable(&op->dev); | 985 | pm_runtime_disable(&op->dev); |
985 | if (!pm_runtime_status_suspended(&op->dev)) | 986 | if (!pm_runtime_status_suspended(&op->dev)) |
diff --git a/drivers/dma/txx9dmac.c b/drivers/dma/txx9dmac.c index 8849318b32b7..7632290e7c14 100644 --- a/drivers/dma/txx9dmac.c +++ b/drivers/dma/txx9dmac.c | |||
@@ -1165,9 +1165,12 @@ static int txx9dmac_chan_remove(struct platform_device *pdev) | |||
1165 | { | 1165 | { |
1166 | struct txx9dmac_chan *dc = platform_get_drvdata(pdev); | 1166 | struct txx9dmac_chan *dc = platform_get_drvdata(pdev); |
1167 | 1167 | ||
1168 | |||
1168 | dma_async_device_unregister(&dc->dma); | 1169 | dma_async_device_unregister(&dc->dma); |
1169 | if (dc->irq >= 0) | 1170 | if (dc->irq >= 0) { |
1171 | devm_free_irq(&pdev->dev, dc->irq, dc); | ||
1170 | tasklet_kill(&dc->tasklet); | 1172 | tasklet_kill(&dc->tasklet); |
1173 | } | ||
1171 | dc->ddev->chan[pdev->id % TXX9_DMA_MAX_NR_CHANNELS] = NULL; | 1174 | dc->ddev->chan[pdev->id % TXX9_DMA_MAX_NR_CHANNELS] = NULL; |
1172 | return 0; | 1175 | return 0; |
1173 | } | 1176 | } |
@@ -1228,8 +1231,10 @@ static int txx9dmac_remove(struct platform_device *pdev) | |||
1228 | struct txx9dmac_dev *ddev = platform_get_drvdata(pdev); | 1231 | struct txx9dmac_dev *ddev = platform_get_drvdata(pdev); |
1229 | 1232 | ||
1230 | txx9dmac_off(ddev); | 1233 | txx9dmac_off(ddev); |
1231 | if (ddev->irq >= 0) | 1234 | if (ddev->irq >= 0) { |
1235 | devm_free_irq(&pdev->dev, ddev->irq, ddev); | ||
1232 | tasklet_kill(&ddev->tasklet); | 1236 | tasklet_kill(&ddev->tasklet); |
1237 | } | ||
1233 | return 0; | 1238 | return 0; |
1234 | } | 1239 | } |
1235 | 1240 | ||