OSDN Git Service

mmc: sdhci-pxav3: fix race between runtime pm and irq
authorJisheng Zhang <jszhang@marvell.com>
Fri, 23 Jan 2015 10:08:21 +0000 (18:08 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 28 Jan 2015 11:32:18 +0000 (12:32 +0100)
commit3bb10f60933e84abfe2be69f60b3486f9b96348b
treeee39347f14bb7f5e4982df9a8e893225d2a620b5
parent7a30f2affa4f7be87c0f6f1b69897a7ca9c4bad0
mmc: sdhci-pxav3: fix race between runtime pm and irq

This patch is to fix a race condition that may cause an unhandled irq,
which results in big sdhci interrupt numbers and endless "mmc1: got irq
while runtime suspended" msgs before v3.15.

Consider following scenario:

      CPU0                            CPU1
                              sdhci_pxav3_runtime_suspend()
                               spin_lock_irqsave(&host->lock, flags);
 sdhci_irq()
  spining on the &host->lock
                               host->runtime_suspended = true;
                               spin_unlock_irqrestore(&host->lock, flags);
  get the &host->lock
  runtime_suspended is true now
  return IRQ_NONE;

Fix this race by using the core sdhci.c supplied sdhci_runtime_suspend_host()
in runtime suspend hook which will disable card interrupts. We also use the
sdhci_runtime_resume_host() in the runtime resume hook accordingly.

Signed-off-by: Jisheng Zhang <jszhang@marvell.com>
Cc: <stable@vger.kernel.org> # v3.9+
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/sdhci-pxav3.c