aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2007-05-08 16:35:17 -0400
committerPierre Ossman <drzeus@drzeus.cx>2007-05-08 16:42:57 -0400
commit1efd48b3ae8f89a1d04f1e36be96764d7bf43ae9 (patch)
tree0d45e47c53d71390519b5890021417e3ec1b2b3b
parent790864dcc2b3fe65355dd84ef8481e54b1bc61b6 (diff)
mmc: use lock instead of claim in debug check
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>
-rw-r--r--drivers/mmc/core/core.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 72c7cf4a9f9d..b6c16704aaab 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -500,9 +500,10 @@ void __mmc_release_bus(struct mmc_host *host)
500void mmc_detect_change(struct mmc_host *host, unsigned long delay) 500void mmc_detect_change(struct mmc_host *host, unsigned long delay)
501{ 501{
502#ifdef CONFIG_MMC_DEBUG 502#ifdef CONFIG_MMC_DEBUG
503 mmc_claim_host(host); 503 unsigned long flags;
504 spin_lock_irqsave(host->lock, flags);
504 BUG_ON(host->removed); 505 BUG_ON(host->removed);
505 mmc_release_host(host); 506 spin_unlock_irqrestore(host->lock, flags);
506#endif 507#endif
507 508
508 mmc_schedule_delayed_work(&host->detect, delay); 509 mmc_schedule_delayed_work(&host->detect, delay);
@@ -625,9 +626,10 @@ EXPORT_SYMBOL(mmc_add_host);
625void mmc_remove_host(struct mmc_host *host) 626void mmc_remove_host(struct mmc_host *host)
626{ 627{
627#ifdef CONFIG_MMC_DEBUG 628#ifdef CONFIG_MMC_DEBUG
628 mmc_claim_host(host); 629 unsigned long flags;
630 spin_lock_irqsave(&host->lock, flags);
629 host->removed = 1; 631 host->removed = 1;
630 mmc_release_host(host); 632 spin_unlock_irqrestore(&host->lock, flags);
631#endif 633#endif
632 634
633 mmc_flush_scheduled_work(); 635 mmc_flush_scheduled_work();