When the card has been added to the device model, it might be bound
to a card driver. Therefore, we have to release the host lock when
trying to remove it as we otherwise might deadlock with the driver.
Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
BUG_ON(!host->card);
mmc_claim_host(host);
BUG_ON(!host->card);
mmc_claim_host(host);
err = mmc_init_card(host, host->ocr, host->card);
err = mmc_init_card(host, host->ocr, host->card);
+ mmc_release_host(host);
+
if (err != MMC_ERR_NONE) {
mmc_remove(host);
if (err != MMC_ERR_NONE) {
mmc_remove(host);
+
+ mmc_claim_host(host);
+ mmc_release_host(host);
- mmc_release_host(host);
err = mmc_add_card(host->card);
if (err)
err = mmc_add_card(host->card);
if (err)
-reclaim_host:
- mmc_claim_host(host);
mmc_remove_card(host->card);
host->card = NULL;
mmc_remove_card(host->card);
host->card = NULL;
err:
mmc_detach_bus(host);
mmc_release_host(host);
err:
mmc_detach_bus(host);
mmc_release_host(host);
BUG_ON(!host->card);
mmc_claim_host(host);
BUG_ON(!host->card);
mmc_claim_host(host);
err = mmc_sd_init_card(host, host->ocr, host->card);
err = mmc_sd_init_card(host, host->ocr, host->card);
+ mmc_release_host(host);
+
if (err != MMC_ERR_NONE) {
mmc_sd_remove(host);
if (err != MMC_ERR_NONE) {
mmc_sd_remove(host);
+
+ mmc_claim_host(host);
+ mmc_release_host(host);
- mmc_release_host(host);
err = mmc_add_card(host->card);
if (err)
err = mmc_add_card(host->card);
if (err)
-reclaim_host:
- mmc_claim_host(host);
mmc_remove_card(host->card);
host->card = NULL;
mmc_remove_card(host->card);
host->card = NULL;
err:
mmc_detach_bus(host);
mmc_release_host(host);
err:
mmc_detach_bus(host);
mmc_release_host(host);