On Thursday 21 October 2010, Ohad Ben-Cohen wrote: > This sounds like adding a set of API that resembles spin_{unlock,lock}_irq. > > My gut feeling here is that while this may be useful and simple at > certain places, it is somewhat error prone; a driver which would > erroneously use this at the wrong place will end up enabling > interrupts where it really shouldn't. > > Don't you feel that proving a simple spin_lock_irqsave-like API is > actually safer and less error prone ? > > I guess that is one of the reasons why spin_lock_irqsave is much more > popular than spin_lock_irq - people just know it will never screw up. People can screw that up in different ways, e.g. spin_lock_irqsave(&lock_a, flags); spin_lock_irqsave(&lock_b, flags); /* overwrites flags */ spin_lock_irqrestore(&lock_b, flags); spin_lock_irqrestore(&lock_a, flags); /* still disabled! */ I use the presence of spin_lock_irqsave in driver code as an indication of whether the author had any clue about locking. Most experienced coders use the right version intuitively, while beginners often just use _irqsave because they didn't understand the API and they were told that using this is safe. Arnd -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html