Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=2986d0bf23d97d68804ccfa80965073ccf1af242
Commit:     2986d0bf23d97d68804ccfa80965073ccf1af242
Parent:     cf795bfb3ad4e2f8f6bb346aa8edb8272d4c70a2
Author:     Pierre Ossman <[EMAIL PROTECTED]>
AuthorDate: Sun Jul 22 17:52:06 2007 +0200
Committer:  Pierre Ossman <[EMAIL PROTECTED]>
CommitDate: Thu Jul 26 01:54:06 2007 +0200

    mmc: Don't hold lock when releasing an added card
    
    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 <[EMAIL PROTECTED]>
---
 drivers/mmc/core/mmc.c |   13 ++++++++-----
 drivers/mmc/core/sd.c  |   13 ++++++++-----
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c
index 1a889e9..cd0c6b2 100644
--- a/drivers/mmc/core/mmc.c
+++ b/drivers/mmc/core/mmc.c
@@ -499,14 +499,17 @@ static void mmc_resume(struct mmc_host *host)
        BUG_ON(!host->card);
 
        mmc_claim_host(host);
-
        err = mmc_init_card(host, host->ocr, host->card);
+       mmc_release_host(host);
+
        if (err != MMC_ERR_NONE) {
                mmc_remove(host);
+
+               mmc_claim_host(host);
                mmc_detach_bus(host);
+               mmc_release_host(host);
        }
 
-       mmc_release_host(host);
 }
 
 #else
@@ -567,14 +570,14 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
 
        err = mmc_add_card(host->card);
        if (err)
-               goto reclaim_host;
+               goto remove_card;
 
        return 0;
 
-reclaim_host:
-       mmc_claim_host(host);
+remove_card:
        mmc_remove_card(host->card);
        host->card = NULL;
+       mmc_claim_host(host);
 err:
        mmc_detach_bus(host);
        mmc_release_host(host);
diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index df3bbfe..0b478de 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -573,14 +573,17 @@ static void mmc_sd_resume(struct mmc_host *host)
        BUG_ON(!host->card);
 
        mmc_claim_host(host);
-
        err = mmc_sd_init_card(host, host->ocr, host->card);
+       mmc_release_host(host);
+
        if (err != MMC_ERR_NONE) {
                mmc_sd_remove(host);
+
+               mmc_claim_host(host);
                mmc_detach_bus(host);
+               mmc_release_host(host);
        }
 
-       mmc_release_host(host);
 }
 
 #else
@@ -648,14 +651,14 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
 
        err = mmc_add_card(host->card);
        if (err)
-               goto reclaim_host;
+               goto remove_card;
 
        return 0;
 
-reclaim_host:
-       mmc_claim_host(host);
+remove_card:
        mmc_remove_card(host->card);
        host->card = NULL;
+       mmc_claim_host(host);
 err:
        mmc_detach_bus(host);
        mmc_release_host(host);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to