]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
mmc: use lock instead of claim in debug check
authorPierre Ossman <drzeus@drzeus.cx>
Tue, 8 May 2007 20:35:17 +0000 (22:35 +0200)
committerPierre Ossman <drzeus@drzeus.cx>
Tue, 8 May 2007 20:42:57 +0000 (22:42 +0200)
As mmc_detect_change() can be called from irq context, using
claim (which can sleep) is inherently unsafe. Use the host
spinlock instead, which also is faster.

Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
drivers/mmc/core/core.c

index 72c7cf4a9f9dbdc6683999b28f9c7e86eda2e0fb..b6c16704aaab770e3f9818f115b1c4253852971d 100644 (file)
@@ -500,9 +500,10 @@ void __mmc_release_bus(struct mmc_host *host)
 void mmc_detect_change(struct mmc_host *host, unsigned long delay)
 {
 #ifdef CONFIG_MMC_DEBUG
-       mmc_claim_host(host);
+       unsigned long flags;
+       spin_lock_irqsave(host->lock, flags);
        BUG_ON(host->removed);
-       mmc_release_host(host);
+       spin_unlock_irqrestore(host->lock, flags);
 #endif
 
        mmc_schedule_delayed_work(&host->detect, delay);
@@ -625,9 +626,10 @@ EXPORT_SYMBOL(mmc_add_host);
 void mmc_remove_host(struct mmc_host *host)
 {
 #ifdef CONFIG_MMC_DEBUG
-       mmc_claim_host(host);
+       unsigned long flags;
+       spin_lock_irqsave(&host->lock, flags);
        host->removed = 1;
-       mmc_release_host(host);
+       spin_unlock_irqrestore(&host->lock, flags);
 #endif
 
        mmc_flush_scheduled_work();