summaryrefslogtreecommitdiff
path: root/drivers/mmc/core
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2017-06-09 15:27:18 +0300
committerUlf Hansson <ulf.hansson@linaro.org>2017-06-20 11:30:39 +0300
commit4760257cb54e29e9a90e0ce849f4efcd67718816 (patch)
tree267191c924710274e1171cddded7ce62aae8536f /drivers/mmc/core
parent82e7edc216f1a066da10f224ae2e4cd83e53fc13 (diff)
downloadlinux-4760257cb54e29e9a90e0ce849f4efcd67718816.tar.xz
mmc: sdio: Keep card runtime resumed while adding function devices
Drivers core will runtime suspend a device with no driver. That means the SDIO card will be runtime suspended as soon as it is added. It is then runtime resumed to add each function. That is entirely pointless, so add pm runtime get/put to keep the SDIO card runtime resumed until the function devices have been added. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
Diffstat (limited to 'drivers/mmc/core')
-rw-r--r--drivers/mmc/core/sdio.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/drivers/mmc/core/sdio.c b/drivers/mmc/core/sdio.c
index f077fc8219d0..cc43687ca241 100644
--- a/drivers/mmc/core/sdio.c
+++ b/drivers/mmc/core/sdio.c
@@ -1104,6 +1104,12 @@ int mmc_attach_sdio(struct mmc_host *host)
*/
if (host->caps & MMC_CAP_POWER_OFF_CARD) {
/*
+ * Do not allow runtime suspend until after SDIO function
+ * devices are added.
+ */
+ pm_runtime_get_noresume(&card->dev);
+
+ /*
* Let runtime PM core know our card is active
*/
err = pm_runtime_set_active(&card->dev);
@@ -1155,6 +1161,9 @@ int mmc_attach_sdio(struct mmc_host *host)
goto remove_added;
}
+ if (host->caps & MMC_CAP_POWER_OFF_CARD)
+ pm_runtime_put(&card->dev);
+
mmc_claim_host(host);
return 0;
@@ -1164,7 +1173,9 @@ remove:
remove_added:
/*
* The devices are being deleted so it is not necessary to disable
- * runtime PM.
+ * runtime PM. Similarly we also don't pm_runtime_put() the SDIO card
+ * because it needs to be active to remove any function devices that
+ * were probed, and after that it gets deleted.
*/
mmc_sdio_remove(host);
mmc_claim_host(host);