Re: [RFC,PATCH 1/2] Add a common struct clk

From: Benjamin Herrenschmidt
Date: Mon Jun 14 2010 - 05:23:40 EST


On Mon, 2010-06-14 at 08:39 +0200, Lothar WaÃmann wrote:
> All implementations so far use spin_lock_irq_save()!

Nothing prevents your implementation to be a tad smarter.

> How would you be able to sleep with a mutex held?
> If you hold a lock you must not sleep, no matter what sort of lock it
> is.

You can perfectly sleep with a mutex held. You -do- have to be careful
of course to ensure you aren't going to do silly thing like re-enter and
try to take it twice, or A->B B->A deadlocks, but in the typical case of
wanting to use a msleep rather than udelay, it works very well :-)

Cheers,
Ben.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/