2010/11/16 David Vrabel <david.vrabel@xxxxxxx>: > Linus Walleij wrote: >> This adds a mutex to protect from races between gate and ungate >> calls colliding. > > Can you rework this to not require both host->clk_gate_mutex and > host->clk_lock? Is host->clk_lock necessary any more? No I can't. I really wanted to, and the bug Ohad spotted was the result of trying to do exactly that. But it doesn't work. The reason is that mmc_host_clk_gate() is called from mmc_request_done(), which may be called from interrupt context, thus it cannot take a mutex. Trying to use only the spinlock gives the inverse problem: the gating code calls out to mmc_set_ios() or mmc_set_clock() which must be called in process context because they can be real slow, and surely shouldn't disable interrupts like taking a spinlock does. So what the patch does is handle slowpath and fastpath alike and for this we need a slowpath synchronization primitive (the mutex) and a fastpath synchronization primitive (the spinlock). Yours, Linus Walleij -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html