mmc: sdio: Keep card runtime resumed while adding function devices
v2 cover mmc: sdio: Keep card runtime resumed while adding function devices
Hi
Here is V2 of the patch to keep an SDIO card runtime resumed while adding function devices.
Changes in V2:
mmc: sdio: Tidy error path in mmc_attach_sdio()
New patch
mmc: sdio: Keep card runtime resumed while adding function devices
Move call to pm_runtime_get_noresume() before pm_runtime_set_active().
Do not use pm_runtime_put() incorrectly (or at all) in the error path.
Adrian Hunter (2):
mmc: sdio: Tidy error path in mmc_attach_sdio()
mmc: sdio: Keep card runtime resumed while adding function devices
drivers/mmc/core/sdio.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
Regards
Adrian
PATCH v2 1/2 mmc: sdio: Tidy error path in mmc_attach_sdio()
The error path deletes the device by calling mmc_sdio_remove() which must be called without the host claimed. Simplify the error path so it does just that and add a comment about why we don't disable runtime PM.
--- drivers/mmc/core/sdio.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
drivers/mmc/core/sdio.c +6 -7
@@ -1159,15 +1159,14 @@ int mmc_attach_sdio(struct mmc_host *host)return 0 ; -remove_added: -/* Remove without lock if the device has been added. */ -mmc_sdio_remove (host); -mmc_claim_host (host); remove: -/* And with lock if it hasn't been added. */ mmc_release_host (host); -if (host->card) -mmc_sdio_remove (host); +remove_added: +/* +* The devices are being deleted so it is not necessary to disable +* runtime PM. +*/ +mmc_sdio_remove (host);mmc_claim_host (host); err:mmc_detach_bus (host);
Signature · 1 line
1.9.1
PATCH v2 2/2 mmc: sdio: Keep card runtime resumed while adding function devices
In reply to Adrian HunterDrivers 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.
--- drivers/mmc/core/sdio.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/mmc/core/sdio.c +12 -1
@@ -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 @@ int mmc_attach_sdio(struct mmc_host *host) 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);
Signature · 1 line
1.9.1
Ulf Hansson
AppliedQuoted 22 lines · Adrian Hunter
Hi
Here is V2 of the patch to keep an SDIO card runtime resumed while adding function devices.
Changes in V2:
mmc: sdio: Tidy error path in
mmc_attach_sdio()
New patchmmc: sdio: Keep card runtime resumed while adding function devices
Move call topm_runtime_get_noresume()beforepm_runtime_set_active().
Do not usepm_runtime_put()incorrectly (or at all) in the error path.Adrian Hunter (2):
mmc: sdio: Tidy error path inmmc_attach_sdio()
mmc: sdio: Keep card runtime resumed while adding function devices
Quoted 6 lines
drivers/mmc/core/sdio.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)Regards
Adrian
Thanks, applied for next!
Kind regards
Uffe