From mboxrd@z Thu Jan 1 00:00:00 1970 From: cjb@laptop.org (Chris Ball) Date: Fri, 27 Aug 2010 20:37:27 +0100 Subject: [PATCH 01/03] omap hsmmc: prevent race between dma and hsmmc callback In-Reply-To: <618f0c911003100611q42e7f23cuc3c8d3f116ca7eb3@mail.gmail.com> References: <618f0c911003100611q42e7f23cuc3c8d3f116ca7eb3@mail.gmail.com> Message-ID: <20100827193727.GF23079@void.printf.net> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi, Looks like the discussion on this patch stopped: do we think there's a race worth fixing here? On Wed, Mar 10, 2010 at 07:41:38PM +0530, Venkatraman S wrote: > See previous post http://patchwork.kernel.org/patch/82907/ > Rebased to 2.6.34-rc1 and fixed comment alignment. > > CC: Adrian Hunter > CC: Madhusudhan C > CC: Tony Lindgren > Signed-off-by: Venkatraman S > --- > drivers/mmc/host/omap_hsmmc.c | 19 +++++++++++-------- > 1 files changed, 11 insertions(+), 8 deletions(-) > > diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c > index 83f0aff..ea2a082 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); > } > > /* > -- > 1.6.3.3 -- Chris Ball One Laptop Per Child