From patchwork Mon Mar 1 11:25:35 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Venkatraman S X-Patchwork-Id: 82907 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o21BPEbL021866 for ; Mon, 1 Mar 2010 11:25:37 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751207Ab0CALZg (ORCPT ); Mon, 1 Mar 2010 06:25:36 -0500 Received: from mail-iw0-f182.google.com ([209.85.223.182]:39980 "EHLO mail-iw0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750764Ab0CALZf (ORCPT ); Mon, 1 Mar 2010 06:25:35 -0500 Received: by mail-iw0-f182.google.com with SMTP id 12so2259873iwn.21 for ; Mon, 01 Mar 2010 03:25:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:date :x-google-sender-auth:message-id:subject:from:to:content-type; bh=CTd8rQse3C52ynSIksi4WAdMJNcWE069Hx6R8sh3Kho=; b=EXNPRNp4SGC3yMZkHygZ0OlD2PDTR8GNMcZryE/Gtgjon0wgLJZ2geLORVeA7MXFGr 1rye0pHp7yUrFfhsq2n+rUm0D/olVz+9yi/Gi+coOE1TAFGhGLgVCGPP5/ULSCaATLVV bKlwZCP77ZqYBa/Y895ia04XY+IobN5h1jbCQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; b=Tx557CzAGGgtQvPBaVYwhdqtp3I5sPCvkmrSw2rboKTEbZsRHl4QGifXPL264vyOHe sGGMNGejZFQxjTvJleroOZJaJ9FresRvC+KCjYVcBNFynueCBoOa4clGHbyH/IyJd5ID IThyQ7qlY+SgdLUm9qzYX2H/eP1i5g4zJdNZw= MIME-Version: 1.0 Received: by 10.231.168.136 with SMTP id u8mr639555iby.56.1267442735448; Mon, 01 Mar 2010 03:25:35 -0800 (PST) Date: Mon, 1 Mar 2010 16:55:35 +0530 X-Google-Sender-Auth: 4ad54d4289c49884 Message-ID: <618f0c911003010325q201fbcedr776da21c709ac421@mail.gmail.com> Subject: [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callback From: Venkatraman S To: linux-mmc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Mon, 01 Mar 2010 11:25:37 +0000 (UTC) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 83f0aff..06337f6 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -1046,8 +1046,18 @@ static irqreturn_t omap_hsmmc_irq(int irq, void *dev_id) if (end_cmd || ((status & CC) && host->cmd)) omap_hsmmc_cmd_done(host, host->cmd); - if ((end_trans || (status & TC)) && host->mrq) + if ((end_trans || (status & TC)) && host->mrq) { omap_hsmmc_xfer_done(host, data); + if (host->dma_ch != -1) { + omap_free_dma(host->dma_ch); + host->dma_ch = -1; + /* + * Callback: run in interrupt context. + * mutex_unlock will throw a kernel warning if used. + */ + up(&host->sem); + } + } spin_unlock(&host->irq_lock); @@ -1267,13 +1277,6 @@ static void omap_hsmmc_dma_cb(int lch, u16 ch_status, void *data) return; } - omap_free_dma(host->dma_ch); - host->dma_ch = -1; - /* - * DMA Callback: run in interrupt context. - * mutex_unlock will throw a kernel warning if used. - */ - up(&host->sem); }