aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/core/sdio.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2015-09-11 08:41:55 -0400
committerUlf Hansson <ulf.hansson@linaro.org>2015-10-26 10:59:52 -0400
commit8d1ffc8c982e4480059ef735e8f15f631e40e80c (patch)
treeb887a15e7e0660f5ec046550bc31cc63b28e09b4 /drivers/mmc/core/sdio.c
parent0cd2f04453fcb7bf3f38a4a72d1619636b4afa57 (diff)
mmc: core: Keep host claimed while invoking mmc_power_off|up()
As mmc_claim_host() invokes pm_runtime_get_sync() for the mmc host device, it's important that the host is kept claimed for *all* accesses to it via the host_ops callbacks. In some code paths for SDIO, particularly related to the PM support, mmc_power_off|up() is invoked without keeping the host claimed. Let's fix these. Moreover, mmc_start|stop_host() also invokes mmc_power_off|up() without claiming the host, let's fix these as well. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Acked-by: Kishon Vijay Abraham I <kishon@ti.com>
Diffstat (limited to 'drivers/mmc/core/sdio.c')
-rw-r--r--drivers/mmc/core/sdio.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index b91abedcfdca..95bc1014b7a2 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -897,11 +897,10 @@ static int mmc_sdio_pre_suspend(struct mmc_host *host)
897 */ 897 */
898static int mmc_sdio_suspend(struct mmc_host *host) 898static int mmc_sdio_suspend(struct mmc_host *host)
899{ 899{
900 if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host)) { 900 mmc_claim_host(host);
901 mmc_claim_host(host); 901
902 if (mmc_card_keep_power(host) && mmc_card_wake_sdio_irq(host))
902 sdio_disable_wide(host->card); 903 sdio_disable_wide(host->card);
903 mmc_release_host(host);
904 }
905 904
906 if (!mmc_card_keep_power(host)) { 905 if (!mmc_card_keep_power(host)) {
907 mmc_power_off(host); 906 mmc_power_off(host);
@@ -910,6 +909,8 @@ static int mmc_sdio_suspend(struct mmc_host *host)
910 mmc_retune_needed(host); 909 mmc_retune_needed(host);
911 } 910 }
912 911
912 mmc_release_host(host);
913
913 return 0; 914 return 0;
914} 915}
915 916
@@ -1018,15 +1019,24 @@ out:
1018static int mmc_sdio_runtime_suspend(struct mmc_host *host) 1019static int mmc_sdio_runtime_suspend(struct mmc_host *host)
1019{ 1020{
1020 /* No references to the card, cut the power to it. */ 1021 /* No references to the card, cut the power to it. */
1022 mmc_claim_host(host);
1021 mmc_power_off(host); 1023 mmc_power_off(host);
1024 mmc_release_host(host);
1025
1022 return 0; 1026 return 0;
1023} 1027}
1024 1028
1025static int mmc_sdio_runtime_resume(struct mmc_host *host) 1029static int mmc_sdio_runtime_resume(struct mmc_host *host)
1026{ 1030{
1031 int ret;
1032
1027 /* Restore power and re-initialize. */ 1033 /* Restore power and re-initialize. */
1034 mmc_claim_host(host);
1028 mmc_power_up(host, host->card->ocr); 1035 mmc_power_up(host, host->card->ocr);
1029 return mmc_sdio_power_restore(host); 1036 ret = mmc_sdio_power_restore(host);
1037 mmc_release_host(host);
1038
1039 return ret;
1030} 1040}
1031 1041
1032static int mmc_sdio_reset(struct mmc_host *host) 1042static int mmc_sdio_reset(struct mmc_host *host)