From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sergei Shtylyov Date: Sun, 15 Feb 2015 16:02:07 +0000 Subject: Re: [PATCH/RFC] mmc: sh_mmcif: Add exclusion between cmd and interrupt Message-Id: <54E0C2FF.3040401@cogentembedded.com> List-Id: References: <1424011607-3682-1-git-send-email-ykaneko0929@gmail.com> In-Reply-To: <1424011607-3682-1-git-send-email-ykaneko0929@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Yoshihiro Kaneko , linux-mmc@vger.kernel.org Cc: Chris Ball , Ulf Hansson , Simon Horman , Magnus Damm , Kuninori Morimoto , linux-sh@vger.kernel.org Hello. On 02/15/2015 05:46 PM, Yoshihiro Kaneko wrote: > From: Kouichi Tomita > A command end interrupt should not be processed between command issue > and setting of wait_for flag. It expects already the flag to be set. > Therefore the exclusive control was added. > Signed-off-by: Kouichi Tomita > Signed-off-by: Yoshihiro Kaneko > --- > This patch is based on next branch of Chris Ball's mmc tree. > drivers/mmc/host/sh_mmcif.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > diff --git a/drivers/mmc/host/sh_mmcif.c b/drivers/mmc/host/sh_mmcif.c > index 7d9d6a3..e5d0b42 100644 > --- a/drivers/mmc/host/sh_mmcif.c > +++ b/drivers/mmc/host/sh_mmcif.c [...] > @@ -1171,6 +1174,12 @@ static irqreturn_t sh_mmcif_irqt(int irq, void *dev_id) > struct sh_mmcif_host *host = dev_id; > struct mmc_request *mrq; > bool wait = false; > + unsigned long flags; > + int wait_work; > + > + spin_lock_irqsave(&host->lock, flags); > + wait_work = host->wait_for; > + spin_unlock_irqrestore(&host->lock, flags); Locking don't seem to have much sense here, as the read is already atomic. WBR, Sergei