mmc: sdio: Allow sdio operations in other threads during sdio_add_func()
authorDmitry Shmidt <dimitrysh@google.com>
Thu, 3 Mar 2011 22:40:10 +0000 (17:40 -0500)
committerChris Ball <cjb@laptop.org>
Mon, 7 Mar 2011 21:55:44 +0000 (16:55 -0500)
This fixes a bug introduced by 807e8e40673d ("mmc: Fix sd/sdio/mmc
initialization frequency retries") that prevented SDIO drivers from
performing SDIO commands in their probe routines -- the above patch
called mmc_claim_host() before sdio_add_func(), which causes a deadlock
if an external SDIO driver calls sdio_claim_host().

Fix tested on an OLPC XO-1.75 with libertas on SDIO.

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Reviewed-and-Tested-by: Chris Ball <cjb@laptop.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
drivers/mmc/core/sdio.c

index 5c4a54d9b6a402ed92dad1ad5b9d1252d908d368..ebc62ad4cc567b7aee3313835050770dd1ff14f0 100644 (file)
@@ -792,7 +792,6 @@ int mmc_attach_sdio(struct mmc_host *host)
         */
        mmc_release_host(host);
        err = mmc_add_card(host->card);
-       mmc_claim_host(host);
        if (err)
                goto remove_added;
 
@@ -805,12 +804,12 @@ int mmc_attach_sdio(struct mmc_host *host)
                        goto remove_added;
        }
 
+       mmc_claim_host(host);
        return 0;
 
 
 remove_added:
        /* Remove without lock if the device has been added. */
-       mmc_release_host(host);
        mmc_sdio_remove(host);
        mmc_claim_host(host);
 remove: