Skip to content

Commit f8def10

Browse files
mantas-pstorulf
authored andcommitted
mmc: sdhci-msm: pervent access to suspended controller
Generic sdhci code registers LED device and uses host->runtime_suspended flag to protect access to it. The sdhci-msm driver doesn't set this flag, which causes a crash when LED is accessed while controller is runtime suspended. Fix this by setting the flag correctly. Cc: [email protected] Fixes: 67e6db1 ("mmc: sdhci-msm: Add pm_runtime and system PM support") Signed-off-by: Mantas Pucka <[email protected]> Acked-by: Adrian Hunter <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent 39cd87c commit f8def10

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/mmc/host/sdhci-msm.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2694,6 +2694,11 @@ static __maybe_unused int sdhci_msm_runtime_suspend(struct device *dev)
26942694
struct sdhci_host *host = dev_get_drvdata(dev);
26952695
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
26962696
struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
2697+
unsigned long flags;
2698+
2699+
spin_lock_irqsave(&host->lock, flags);
2700+
host->runtime_suspended = true;
2701+
spin_unlock_irqrestore(&host->lock, flags);
26972702

26982703
/* Drop the performance vote */
26992704
dev_pm_opp_set_rate(dev, 0);
@@ -2708,6 +2713,7 @@ static __maybe_unused int sdhci_msm_runtime_resume(struct device *dev)
27082713
struct sdhci_host *host = dev_get_drvdata(dev);
27092714
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
27102715
struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
2716+
unsigned long flags;
27112717
int ret;
27122718

27132719
ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks),
@@ -2726,7 +2732,15 @@ static __maybe_unused int sdhci_msm_runtime_resume(struct device *dev)
27262732

27272733
dev_pm_opp_set_rate(dev, msm_host->clk_rate);
27282734

2729-
return sdhci_msm_ice_resume(msm_host);
2735+
ret = sdhci_msm_ice_resume(msm_host);
2736+
if (ret)
2737+
return ret;
2738+
2739+
spin_lock_irqsave(&host->lock, flags);
2740+
host->runtime_suspended = false;
2741+
spin_unlock_irqrestore(&host->lock, flags);
2742+
2743+
return ret;
27302744
}
27312745

27322746
static const struct dev_pm_ops sdhci_msm_pm_ops = {

0 commit comments

Comments
 (0)