From patchwork Sat Jul 16 13:12:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vinod Koul X-Patchwork-Id: 9233207 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 405246075E for ; Sat, 16 Jul 2016 13:05:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25518223A5 for ; Sat, 16 Jul 2016 13:05:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 199C9228C9; Sat, 16 Jul 2016 13:05:11 +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 B3466223A5 for ; Sat, 16 Jul 2016 13:05:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751555AbcGPNFH (ORCPT ); Sat, 16 Jul 2016 09:05:07 -0400 Received: from mga14.intel.com ([192.55.52.115]:50776 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751540AbcGPNFG (ORCPT ); Sat, 16 Jul 2016 09:05:06 -0400 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga103.fm.intel.com with ESMTP; 16 Jul 2016 06:05:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,373,1464678000"; d="scan'208";a="1018070832" Received: from vkoul-udesk7.iind.intel.com (HELO localhost) ([10.223.84.143]) by orsmga002.jf.intel.com with ESMTP; 16 Jul 2016 06:05:03 -0700 Date: Sat, 16 Jul 2016 18:42:21 +0530 From: Vinod Koul To: Sascha Hauer Cc: dmaengine@vger.kernel.org, Linus Walleij Subject: Re: [PATCH 11/32] dmaengine: imx-dma: explicitly freeup irq Message-ID: <20160716131221.GW9681@localhost> References: <1467730478-9696-1-git-send-email-vinod.koul@intel.com> <1467730478-9696-12-git-send-email-vinod.koul@intel.com> <20160706090206.GU20657@pengutronix.de> <20160706170722.GC12591@localhost> <20160708053423.GP20657@pengutronix.de> <20160708074305.GR12591@localhost> <20160708125547.GS20657@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160708125547.GS20657@pengutronix.de> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: dmaengine-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: dmaengine@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Fri, Jul 08, 2016 at 02:55:47PM +0200, Sascha Hauer wrote: > > Let me know your preference and I will change this accordingly > > I prefer disable_irq(). Okay updated this patch to: -- ><8 -- commit e605e5e5bb927323a633356e9b695f715a9033ec Author: Vinod Koul Date: Sat Jul 2 15:25:01 2016 +0530 dmaengine: imx-dma: explicitly freeup irq dmaengine device should explicitly call devm_free_irq() when using devm_reqister_irq(). The irq is still ON when devices remove is executed and irq should be quiesced before remove is completed. Signed-off-by: Vinod Koul diff --git a/drivers/dma/imx-dma.c b/drivers/dma/imx-dma.c index 48d85f8b95fe..914377b4d70b 100644 --- a/drivers/dma/imx-dma.c +++ b/drivers/dma/imx-dma.c @@ -167,6 +167,7 @@ struct imxdma_channel { u32 ccr_to_device; bool enabled_2d; int slot_2d; + unsigned int irq; }; enum imx_dma_type { @@ -186,6 +187,9 @@ struct imxdma_engine { struct imx_dma_2d_config slots_2d[IMX_DMA_2D_SLOTS]; struct imxdma_channel channel[IMX_DMA_CHANNELS]; enum imx_dma_type devtype; + unsigned int irq; + unsigned int irq_err; + }; struct imxdma_filter_data { @@ -1100,6 +1104,7 @@ static int __init imxdma_probe(struct platform_device *pdev) dev_warn(imxdma->dev, "Can't register IRQ for DMA\n"); goto disable_dma_ahb_clk; } + imxdma->irq = irq; irq_err = platform_get_irq(pdev, 1); if (irq_err < 0) { @@ -1113,6 +1118,7 @@ static int __init imxdma_probe(struct platform_device *pdev) dev_warn(imxdma->dev, "Can't register ERRIRQ for DMA\n"); goto disable_dma_ahb_clk; } + imxdma->irq_err = irq_err; } /* enable DMA module */ @@ -1150,6 +1156,8 @@ static int __init imxdma_probe(struct platform_device *pdev) irq + i, i); goto disable_dma_ahb_clk; } + + imxdmac->irq = irq + i; init_timer(&imxdmac->watchdog); imxdmac->watchdog.function = &imxdma_watchdog; imxdmac->watchdog.data = (unsigned long)imxdmac; @@ -1217,10 +1225,29 @@ disable_dma_ipg_clk: return ret; } +static void imxdma_free_irq(struct platform_device *pdev, struct imxdma_engine *imxdma) +{ + int i; + + if (is_imx1_dma(imxdma)) { + disable_irq(imxdma->irq); + disable_irq(imxdma->irq_err); + } + + for (i = 0; i < IMX_DMA_CHANNELS; i++) { + struct imxdma_channel *imxdmac = &imxdma->channel[i]; + + if (!is_imx1_dma(imxdma)) + disable_irq(imxdmac->irq); + } +} + static int imxdma_remove(struct platform_device *pdev) { struct imxdma_engine *imxdma = platform_get_drvdata(pdev); + imxdma_free_irq(pdev, imxdma); + dma_async_device_unregister(&imxdma->dma_device); if (pdev->dev.of_node)