summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2019-09-13 11:20:22 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-09-19 09:10:56 +0200
commit46d1c96a1a5efcf64c46c8fd356a7f7ad05a2b37 (patch)
tree26ce142fa58ee7e99d6a3e1dacf5984402be4ea9
parentf5e9862fedd0e4e35dc8dd8b49fbb1fd31e6f2bc (diff)
downloadlinux-stable-46d1c96a1a5efcf64c46c8fd356a7f7ad05a2b37.tar.gz
linux-stable-46d1c96a1a5efcf64c46c8fd356a7f7ad05a2b37.tar.bz2
linux-stable-46d1c96a1a5efcf64c46c8fd356a7f7ad05a2b37.zip
mmc: tmio: Fixup runtime PM management during remove
commit 87b5d602a1cc76169b8d81ec2c74c8d95d9350dc upstream. Accessing the device when it may be runtime suspended is a bug, which is the case in tmio_mmc_host_remove(). Let's fix the behaviour. Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Tested-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/mmc/host/tmio_mmc_core.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c
index a22b10363033..29ec78486e69 100644
--- a/drivers/mmc/host/tmio_mmc_core.c
+++ b/drivers/mmc/host/tmio_mmc_core.c
@@ -1284,12 +1284,11 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
struct platform_device *pdev = host->pdev;
struct mmc_host *mmc = host->mmc;
+ pm_runtime_get_sync(&pdev->dev);
+
if (host->pdata->flags & TMIO_MMC_SDIO_IRQ)
sd_ctrl_write16(host, CTL_TRANSACTION_CTL, 0x0000);
- if (!host->native_hotplug)
- pm_runtime_get_sync(&pdev->dev);
-
dev_pm_qos_hide_latency_limit(&pdev->dev);
mmc_remove_host(mmc);
@@ -1298,6 +1297,8 @@ void tmio_mmc_host_remove(struct tmio_mmc_host *host)
tmio_mmc_release_dma(host);
pm_runtime_dont_use_autosuspend(&pdev->dev);
+ if (host->native_hotplug)
+ pm_runtime_put_noidle(&pdev->dev);
pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev);
}