From patchwork Sun Jan 1 02:42:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhao X-Patchwork-Id: 6011 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id 982CD23E0C for ; Sun, 1 Jan 2012 02:42:41 +0000 (UTC) Received: from mail-ey0-f180.google.com (mail-ey0-f180.google.com [209.85.215.180]) by fiordland.canonical.com (Postfix) with ESMTP id 85612A1844E for ; Sun, 1 Jan 2012 02:42:41 +0000 (UTC) Received: by eaac11 with SMTP id c11so13791336eaa.11 for ; Sat, 31 Dec 2011 18:42:41 -0800 (PST) Received: by 10.204.156.219 with SMTP id y27mr9468209bkw.71.1325385760386; Sat, 31 Dec 2011 18:42:40 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.205.82.144 with SMTP id ac16cs286598bkc; Sat, 31 Dec 2011 18:42:39 -0800 (PST) Received: by 10.50.51.199 with SMTP id m7mr53123564igo.23.1325385758606; Sat, 31 Dec 2011 18:42:38 -0800 (PST) Received: from richard-laptop ([114.95.105.23]) by mx.google.com with ESMTP id k8si22003912icx.129.2011.12.31.18.42.34; Sat, 31 Dec 2011 18:42:38 -0800 (PST) Received-SPF: neutral (google.com: 114.95.105.23 is neither permitted nor denied by best guess record for domain of richard@richard-laptop) client-ip=114.95.105.23; Authentication-Results: mx.google.com; spf=neutral (google.com: 114.95.105.23 is neither permitted nor denied by best guess record for domain of richard@richard-laptop) smtp.mail=richard@richard-laptop Received: by richard-laptop (Postfix, from userid 1000) id AA73DE38D0; Sun, 1 Jan 2012 10:42:31 +0800 (CST) From: Richard Zhao To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: kernel@pengutronix.de, shawn.guo@linaro.org, vinod.koul@intel.com, dan.j.williams@intel.com, eric.miao@linaro.org, patches@linaro.org, Haitao Zhang , Haitao Zhang , Richard Zhao Subject: [PATCH] dma/imx-sdma: save irq flags when use spin_lock in sdma_tx_submit Date: Sun, 1 Jan 2012 10:42:19 +0800 Message-Id: <1325385739-2565-1-git-send-email-richard.zhao@linaro.org> X-Mailer: git-send-email 1.7.4.1 From: Haitao Zhang mx53_loco: fix deadlock report from sdma_tx_submit() during boot BugLink: http://bugs.launchpad.net/bugs/878701 Adjust to use spin_lock_irqsave()/spin_unlock_irqresotre(), so to make it safe when called from interrupt context. Signed-off-by: Haitao Zhang Signed-off-by: Eric Miao Signed-off-by: Richard Zhao --- drivers/dma/imx-sdma.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c index f993955..2b7a88b 100644 --- a/drivers/dma/imx-sdma.c +++ b/drivers/dma/imx-sdma.c @@ -832,17 +832,18 @@ static struct sdma_channel *to_sdma_chan(struct dma_chan *chan) static dma_cookie_t sdma_tx_submit(struct dma_async_tx_descriptor *tx) { + unsigned long flags; struct sdma_channel *sdmac = to_sdma_chan(tx->chan); struct sdma_engine *sdma = sdmac->sdma; dma_cookie_t cookie; - spin_lock_irq(&sdmac->lock); + spin_lock_irqsave(&sdmac->lock, flags); cookie = sdma_assign_cookie(sdmac); sdma_enable_channel(sdma, sdmac->channel); - spin_unlock_irq(&sdmac->lock); + spin_unlock_irqrestore(&sdmac->lock, flags); return cookie; }