public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: cjb@laptop.org (Chris Ball)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] sdhci-s3c: fix incorrect spinlock usage after merge
Date: Tue, 21 Sep 2010 04:15:49 +0100	[thread overview]
Message-ID: <20100921031547.GA7073@void.printf.net> (raw)
In-Reply-To: <1284987822-17955-1-git-send-email-m.szyprowski@samsung.com>

Hi Ben,

On Mon, Sep 20, 2010 at 03:03:42PM +0200, Marek Szyprowski wrote:
> In the commit f522886e202a34a2191dd5d471b3c4d46410a9a0 a merge conflict
> in the sdhci-s3c driver been fixed. However the fix used incorrect
> spinlock operation - it cause a race with sdhci interrupt service. The
> correct way to solve it is to use spin_lock_irqsave/irqrestore() calls.
> 
> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> ---
>  drivers/mmc/host/sdhci-s3c.c |    6 ++++--
>  1 files changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mmc/host/sdhci-s3c.c b/drivers/mmc/host/sdhci-s3c.c
> index 71ad416..735d431 100644
> --- a/drivers/mmc/host/sdhci-s3c.c
> +++ b/drivers/mmc/host/sdhci-s3c.c
> @@ -241,8 +241,10 @@ static struct sdhci_ops sdhci_s3c_ops = {
>  static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
>  {
>  	struct sdhci_host *host = platform_get_drvdata(dev);
> +	unsigned long flags;
> +
>  	if (host) {
> -		spin_lock(&host->lock);
> +		spin_lock_irqsave(&host->lock, flags);
>  		if (state) {
>  			dev_dbg(&dev->dev, "card inserted.\n");
>  			host->flags &= ~SDHCI_DEVICE_DEAD;
> @@ -253,7 +255,7 @@ static void sdhci_s3c_notify_change(struct platform_device *dev, int state)
>  			host->quirks &= ~SDHCI_QUIRK_BROKEN_CARD_DETECTION;
>  		}
>  		tasklet_schedule(&host->card_tasklet);
> -		spin_unlock(&host->lock);
> +		spin_unlock_irqrestore(&host->lock, flags);
>  	}
>  }
>  

Could I have your ACK on this before I send it to Linus, please?

Thanks,

-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

      parent reply	other threads:[~2010-09-21  3:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-20 13:03 [PATCH] sdhci-s3c: fix incorrect spinlock usage after merge Marek Szyprowski
2010-09-21  1:17 ` Chris Ball
2010-09-21  1:29   ` Andrew Morton
2010-09-21  3:15 ` Chris Ball [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100921031547.GA7073@void.printf.net \
    --to=cjb@laptop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox