diff options
| author | Jisheng Zhang <jszhang@marvell.com> | 2015-01-23 05:08:21 -0500 |
|---|---|---|
| committer | Ulf Hansson <ulf.hansson@linaro.org> | 2015-01-28 06:32:18 -0500 |
| commit | 3bb10f60933e84abfe2be69f60b3486f9b96348b (patch) | |
| tree | ee39347f14bb7f5e4982df9a8e893225d2a620b5 /drivers/mmc/host/sdhci-pxav3.c | |
| parent | 7a30f2affa4f7be87c0f6f1b69897a7ca9c4bad0 (diff) | |
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>
Diffstat (limited to 'drivers/mmc/host/sdhci-pxav3.c')
| -rw-r--r-- | drivers/mmc/host/sdhci-pxav3.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c index 63967b85dc42..c5db5d271ee7 100644 --- a/drivers/mmc/host/sdhci-pxav3.c +++ b/drivers/mmc/host/sdhci-pxav3.c | |||
| @@ -458,11 +458,11 @@ static int sdhci_pxav3_runtime_suspend(struct device *dev) | |||
| 458 | struct sdhci_host *host = dev_get_drvdata(dev); | 458 | struct sdhci_host *host = dev_get_drvdata(dev); |
| 459 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | 459 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
| 460 | struct sdhci_pxa *pxa = pltfm_host->priv; | 460 | struct sdhci_pxa *pxa = pltfm_host->priv; |
| 461 | unsigned long flags; | 461 | int ret; |
| 462 | 462 | ||
| 463 | spin_lock_irqsave(&host->lock, flags); | 463 | ret = sdhci_runtime_suspend_host(host); |
| 464 | host->runtime_suspended = true; | 464 | if (ret) |
| 465 | spin_unlock_irqrestore(&host->lock, flags); | 465 | return ret; |
| 466 | 466 | ||
| 467 | clk_disable_unprepare(pxa->clk_io); | 467 | clk_disable_unprepare(pxa->clk_io); |
| 468 | if (!IS_ERR(pxa->clk_core)) | 468 | if (!IS_ERR(pxa->clk_core)) |
| @@ -476,17 +476,12 @@ static int sdhci_pxav3_runtime_resume(struct device *dev) | |||
| 476 | struct sdhci_host *host = dev_get_drvdata(dev); | 476 | struct sdhci_host *host = dev_get_drvdata(dev); |
| 477 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); | 477 | struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); |
| 478 | struct sdhci_pxa *pxa = pltfm_host->priv; | 478 | struct sdhci_pxa *pxa = pltfm_host->priv; |
| 479 | unsigned long flags; | ||
| 480 | 479 | ||
| 481 | clk_prepare_enable(pxa->clk_io); | 480 | clk_prepare_enable(pxa->clk_io); |
| 482 | if (!IS_ERR(pxa->clk_core)) | 481 | if (!IS_ERR(pxa->clk_core)) |
| 483 | clk_prepare_enable(pxa->clk_core); | 482 | clk_prepare_enable(pxa->clk_core); |
| 484 | 483 | ||
| 485 | spin_lock_irqsave(&host->lock, flags); | 484 | return sdhci_runtime_resume_host(host); |
| 486 | host->runtime_suspended = false; | ||
| 487 | spin_unlock_irqrestore(&host->lock, flags); | ||
| 488 | |||
| 489 | return 0; | ||
| 490 | } | 485 | } |
| 491 | #endif | 486 | #endif |
| 492 | 487 | ||
