diff mbox

[02/32] dmaengine: coh901318: kill the tasklets upon exit

Message ID 1467730478-9696-3-git-send-email-vinod.koul@intel.com (mailing list archive)
State Accepted
Headers show

Commit Message

Vinod Koul July 5, 2016, 2:54 p.m. UTC
drivers should ensure that tasklets are killed, so that they can't be
run after driver remove is executed.

Signed-off-by: Vinod Koul <vinod.koul@intel.com>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/dma/coh901318.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Linus Walleij July 5, 2016, 9:11 p.m. UTC | #1
On Tue, Jul 5, 2016 at 4:54 PM, Vinod Koul <vinod.koul@intel.com> wrote:

> drivers should ensure that tasklets are killed, so that they can't be
> run after driver remove is executed.
>
> Signed-off-by: Vinod Koul <vinod.koul@intel.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index ba044d4c1d53..9b86c3e85011 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -2758,6 +2758,21 @@  static int __init coh901318_probe(struct platform_device *pdev)
 	coh901318_pool_destroy(&base->pool);
 	return err;
 }
+static void coh901318_base_remove(struct coh901318_base *base, const int *pick_chans)
+{
+	int chans_i;
+	int i = 0;
+	struct coh901318_chan *cohc;
+
+	for (chans_i = 0; pick_chans[chans_i] != -1; chans_i += 2) {
+		for (i = pick_chans[chans_i]; i <= pick_chans[chans_i+1]; i++) {
+			cohc = &base->chans[i];
+
+			tasklet_kill(&cohc->tasklet);
+		}
+	}
+
+}
 
 static int coh901318_remove(struct platform_device *pdev)
 {
@@ -2765,6 +2780,9 @@  static int coh901318_remove(struct platform_device *pdev)
 
 	devm_free_irq(&pdev->dev, base->irq, base);
 
+	coh901318_base_remove(base, dma_slave_channels);
+	coh901318_base_remove(base, dma_memcpy_channels);
+
 	of_dma_controller_free(pdev->dev.of_node);
 	dma_async_device_unregister(&base->dma_memcpy);
 	dma_async_device_unregister(&base->dma_slave);