On Sun, 16 Aug 2009, Heiko Carstens wrote: > > do you have any objections to the approach below? > Just wondering, since I didn't receive any comments. Other things going on, but here goes: > > +#ifdef __spin_lock_is_small > > +#define _spin_lock(lock) __spin_lock(lock) > > +#else > > +void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock); > > +#endif The above repeats many times, and I found that irritating. I think you should be able to get rid of a _lot_ of that by doing it like this instead extern void __lockfunc _spin_lock(spinlock_t *lock) __acquires(lock); ... plain declarations for all cases, no #ifdef's ... and then at the end you just do #ifdef __spin_lock_is_small #define _spin_lock(lock) __spin_lock(lock) #endif .. and at least make that repeating section be composed of simpler and smaller entries. Now, I actually have a disgusting way to avoid the #ifdef's entirely, but I'm not sure it's worth it. You'd do the same unconditional function declarations, but then we can also do some unconditional CPP expansions: #define __define2_lock(name,extent) name##extent #define __define_lock(name,extent) __define2_lock(name,extent) #define define_lock(name) __define_lock(__##name, __##name##_is_small) // for each lock type #define __spin_lock__spin_lock_is_small _spin_lock #define _spin_lock define_lock(spin_lock) and what happens is that if '__spin_lock_is_small' is undefined, you end up having '_spin_lock()' expand to '__spin_lock__spin_lock_is_small()' and then back to _spin_lock, but if it's #defined (to empty), it gets defined to __spin_lock() instead. No ifdefs, just two unconditional #define lines for each lock type. Ugly? Yes. Less ugly than having variations of that #ifdef repeated many times? I dunno. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-arch" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html