On Fri, Mar 02, 2007 at 11:47:52PM +0100, Heiko Carstens wrote: > /* > + * Locks two spinlocks l1 and l2. > + * l1_first indicates if spinlock l1 should be taken first. > + */ > +static inline void double_spin_lock(spinlock_t *l1, spinlock_t *l2, > + bool l1_first) > + __acquires(l1) > + __acquires(l2) > +{ > + if (l1_first) { > + spin_lock(l1); > + spin_lock(l2); > + } else { > + spin_lock(l2); > + spin_lock(l1); > + } > +} Two observations: - We probably don't want people using this for locks that aren't explicitly in the same level of the hierarchy. The name should somehow indicate that. Something like spin_lock_siblings()? - And once we know that, we can internally impose a natural stable ordering on them based on their addresses, eliminating the third argument and the need to duplicate the ordering calculation. -- Mathematics is the supreme nostalgia of our time. - To unsubscribe from this list: send the line "unsubscribe linux-s390" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html