From patchwork Tue Jul 5 14:54:08 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 9214475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 61BBD60752 for ; Tue, 5 Jul 2016 14:47:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53ADF25404 for ; Tue, 5 Jul 2016 14:47:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 47F062574A; Tue, 5 Jul 2016 14:47:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EACFF25404 for ; Tue, 5 Jul 2016 14:47:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932821AbcGEOr4 (ORCPT ); Tue, 5 Jul 2016 10:47:56 -0400 Received: from mga02.intel.com ([134.134.136.20]:11075 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932976AbcGEOr4 (ORCPT ); Tue, 5 Jul 2016 10:47:56 -0400 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 05 Jul 2016 07:47:54 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,580,1459839600"; d="scan'208";a="1016033057" Received: from vkoul-udesk7.iind.intel.com ([10.223.84.143]) by fmsmga002.fm.intel.com with ESMTP; 05 Jul 2016 07:47:51 -0700 From: Vinod Koul To: dmaengine@vger.kernel.org Cc: Vinod Koul , Linus Walleij Subject: [PATCH 02/32] dmaengine: coh901318: kill the tasklets upon exit Date: Tue, 5 Jul 2016 20:24:08 +0530 Message-Id: <1467730478-9696-3-git-send-email-vinod.koul@intel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1467730478-9696-1-git-send-email-vinod.koul@intel.com> References: <1467730478-9696-1-git-send-email-vinod.koul@intel.com> Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP drivers should ensure that tasklets are killed, so that they can't be run after driver remove is executed. Signed-off-by: Vinod Koul Cc: Linus Walleij Acked-by: Linus Walleij --- drivers/dma/coh901318.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) 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);