[PATCH 1/1] [RFCv2] arm: add half-word __xchg
Russell King - ARM Linux
linux at arm.linux.org.uk
Sat Mar 27 18:52:40 EDT 2010
On Thu, Mar 25, 2010 at 06:42:46PM +0200, Alexander Shishkin wrote:
> +/*
> + * emulate __xchg() using 32-bit __cmpxchg()
> + */
> +static inline unsigned long __xchg_generic(unsigned long x,
> + volatile void *ptr, int size)
> +{
> + unsigned long *ptrbig = (unsigned long *)((unsigned long)ptr & ~3UL);
> + int shift = ((unsigned)ptr - (unsigned)ptrbig) * 8;
I wonder if we should be using __alignof__ here.
unsigned long *ptrbig = (unsigned long *)((unsigned long)ptr &
(__alignof__(unsigned long) - 1));
Rest of the patch looks fine; it'd be nice to get some tested-by's for it
though.
More information about the linux-arm-kernel
mailing list