On Friday 18 June 2010, Mathieu Lacage wrote: > I have been using the asm-generic/system.h header to implement my > version of arch/xx/include/asm/system.h: it appears that the version of > cmpxchg defined in this generic header does not handle correctly > non-long arguments on an LP64 arch. That looks like a correct observation. It's also true on ILP32 architectures. I am not sure though if it is actually supposed to operate on other types, I think there was some disagreement on this in the past. What code specifically did you find needs to do cmpxchg on non-long data? > - > -#define cmpxchg(ptr, o, n) \ > - ((__typeof__(*(ptr))) __cmpxchg((unsigned long *)(ptr), \ > - (unsigned long)(o), \ > - (unsigned long)(n))) > +#define cmpxchg(ptr, o, n) cmpxchg_local(ptr, o, n) This seems to match what we have in include/asm-generic/cmpxchg.h. Maybe the best option would be to include that in asm-generic/system.h. Nobody so far is using asm-generic/system.h, not even tile, which uses most of the generic headers. This makes it quite likely that the file is not correct right now. If you think you can improve it, go wild. BTW, what architecture are you working on? Is this something you plan to submit for inclusion soon? Arnd -- 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