From patchwork Sun Jan 1 03:30:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhao X-Patchwork-Id: 6013 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 BE47623E07 for ; Sun, 1 Jan 2012 03:30:21 +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 A4AB2A18418 for ; Sun, 1 Jan 2012 03:30:21 +0000 (UTC) Received: by eaac11 with SMTP id c11so13805390eaa.11 for ; Sat, 31 Dec 2011 19:30:21 -0800 (PST) Received: by 10.205.138.136 with SMTP id is8mr10017769bkc.35.1325388621402; Sat, 31 Dec 2011 19:30:21 -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 ac16cs287096bkc; Sat, 31 Dec 2011 19:30:21 -0800 (PST) Received: by 10.50.189.137 with SMTP id gi9mr17705900igc.1.1325388619163; Sat, 31 Dec 2011 19:30:19 -0800 (PST) Received: from mail-iy0-f178.google.com (mail-iy0-f178.google.com [209.85.210.178]) by mx.google.com with ESMTPS id hv9si10958834icc.113.2011.12.31.19.30.17 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 31 Dec 2011 19:30:19 -0800 (PST) Received-SPF: neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of richard.zhao@linaro.org) client-ip=209.85.210.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.210.178 is neither permitted nor denied by best guess record for domain of richard.zhao@linaro.org) smtp.mail=richard.zhao@linaro.org Received: by iagf6 with SMTP id f6so32396196iag.37 for ; Sat, 31 Dec 2011 19:30:17 -0800 (PST) Received: by 10.42.189.5 with SMTP id dc5mr45049893icb.51.1325388617428; Sat, 31 Dec 2011 19:30:17 -0800 (PST) Received: from localhost.localdomain ([114.95.105.23]) by mx.google.com with ESMTPS id r5sm60369830igl.3.2011.12.31.19.30.09 (version=SSLv3 cipher=OTHER); Sat, 31 Dec 2011 19:30:15 -0800 (PST) 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 11:30:06 +0800 Message-Id: <1325388606-20732-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 Acked-by: Sascha Hauer --- 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; }