From patchwork Fri Oct 30 03:30:04 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: HU TAO-TGHK48 X-Patchwork-Id: 56553 X-Patchwork-Delegate: tony@atomide.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n9U3UmUU020055 for ; Fri, 30 Oct 2009 03:30:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755037AbZJ3Da1 (ORCPT ); Thu, 29 Oct 2009 23:30:27 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754806AbZJ3Da0 (ORCPT ); Thu, 29 Oct 2009 23:30:26 -0400 Received: from mail128.messagelabs.com ([216.82.250.131]:39342 "EHLO mail128.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754694AbZJ3DaY convert rfc822-to-8bit (ORCPT ); Thu, 29 Oct 2009 23:30:24 -0400 X-VirusChecked: Checked X-Env-Sender: taohu@motorola.com X-Msg-Ref: server-5.tower-128.messagelabs.com!1256873428!10469904!1 X-StarScan-Version: 6.1.3; banners=-,-,- X-Originating-IP: [136.182.1.12] Received: (qmail 25573 invoked from network); 30 Oct 2009 03:30:29 -0000 Received: from motgate2.mot.com (HELO motgate2.mot.com) (136.182.1.12) by server-5.tower-128.messagelabs.com with DHE-RSA-AES256-SHA encrypted SMTP; 30 Oct 2009 03:30:29 -0000 Received: from il27exr04.cig.mot.com (il27exr04.mot.com [10.17.196.73]) by motgate2.mot.com (8.14.3/8.14.3) with ESMTP id n9U3USkO005973 for ; Thu, 29 Oct 2009 20:30:28 -0700 (MST) Received: from il27vts01 (il27vts01.cig.mot.com [10.17.196.85]) by il27exr04.cig.mot.com (8.13.1/Vontu) with SMTP id n9U3USh8002121 for ; Thu, 29 Oct 2009 22:30:28 -0500 (CDT) Received: from ZMY16EXM66.ds.mot.com (zmy16exm66.ap.mot.com [10.179.4.26]) by il27exr04.cig.mot.com (8.13.1/8.13.0) with ESMTP id n9U3UQ4i002111 for ; Thu, 29 Oct 2009 22:30:27 -0500 (CDT) X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Subject: [PATCH] Fix race condition in omap_request_dma() Date: Fri, 30 Oct 2009 11:30:04 +0800 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: [PATCH] Fix race condition in omap_request_dma() thread-index: AcpZEUUXSdsUmRgrSdCF8Cp+03maJA== From: "HU TAO-TGHK48" To: , "Tony Lindgren" Cc: "Yang Fei-AFY095" , , "Zhou Ming-a17711" , "Ye Yuan.Bo-A22116" X-CFilter-Loop: Reflected Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c index cd53b28..6895484 100755 --- a/arch/arm/plat-omap/dma.c +++ b/arch/arm/plat-omap/dma.c @@ -749,11 +749,13 @@ int omap_request_dma(int dev_id, const char *dev_name, } if (cpu_class_is_omap2()) { + spin_lock_irqsave(&dma_chan_lock, flags); omap2_enable_irq_lch(free_ch); omap_enable_channel_irq(free_ch); /* Clear the CSR register and IRQ status register */ dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR(free_ch)); dma_write(1 << free_ch, IRQSTATUS_L0); + spin_unlock_irqrestore(&dma_chan_lock, flags); }