提交 1efd48b3 编写于 作者: P Pierre Ossman

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: NPierre Ossman <drzeus@drzeus.cx>
上级 790864dc
...@@ -500,9 +500,10 @@ void __mmc_release_bus(struct mmc_host *host) ...@@ -500,9 +500,10 @@ void __mmc_release_bus(struct mmc_host *host)
void mmc_detect_change(struct mmc_host *host, unsigned long delay) void mmc_detect_change(struct mmc_host *host, unsigned long delay)
{ {
#ifdef CONFIG_MMC_DEBUG #ifdef CONFIG_MMC_DEBUG
mmc_claim_host(host); unsigned long flags;
spin_lock_irqsave(host->lock, flags);
BUG_ON(host->removed); BUG_ON(host->removed);
mmc_release_host(host); spin_unlock_irqrestore(host->lock, flags);
#endif #endif
mmc_schedule_delayed_work(&host->detect, delay); mmc_schedule_delayed_work(&host->detect, delay);
...@@ -625,9 +626,10 @@ EXPORT_SYMBOL(mmc_add_host); ...@@ -625,9 +626,10 @@ EXPORT_SYMBOL(mmc_add_host);
void mmc_remove_host(struct mmc_host *host) void mmc_remove_host(struct mmc_host *host)
{ {
#ifdef CONFIG_MMC_DEBUG #ifdef CONFIG_MMC_DEBUG
mmc_claim_host(host); unsigned long flags;
spin_lock_irqsave(&host->lock, flags);
host->removed = 1; host->removed = 1;
mmc_release_host(host); spin_unlock_irqrestore(&host->lock, flags);
#endif #endif
mmc_flush_scheduled_work(); mmc_flush_scheduled_work();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册