[parisc-linux] xchg/cmpxchg defined in wrong place?
Fri, 29 Dec 2000 21:12:19 -0800 (PST)
Hello Linux Kernel Guru's,
After surveying all the arches that define __HAVE_ARCH_CMPXCHG:
./include/asm-alpha/system.h:#define __HAVE_ARCH_CMPXCHG 1
./include/asm-i386/system.h:#define __HAVE_ARCH_CMPXCHG 1
./include/asm-ia64/system.h:#define __HAVE_ARCH_CMPXCHG 1
./include/asm-ppc/system.h:#define __HAVE_ARCH_CMPXCHG 1
./include/asm-sparc64/system.h:#define __HAVE_ARCH_CMPXCHG 1
I've come to the conclusion xchg/cmpxchg definitions do NOT
belong in system.h. AFAICT, all the above use Load Linked semantics
(or in the i386 case, operation is atomic). In other words, xchg/cmpxchg
are atomic operations. Shouldn't xchg/cmpxchg definitions live
with other atomic operations - asm/atomic.h?
Currently, parisc __xchg lives in arch/parisc/kernel/setup.c. There is no
way to inline xchg or cmpxchg for parisc at the moment. And given the
dependendencies between asm/system.h, asm/spinlock.h, and asm/atomic.h,
I'm not trying to inline them. Perhaps when the definitions formally move
to atomic.h (or other more appropriate place).
And to add insult to injury, drivers/char/drm/drmP.h (the only visible
consumer of __HAVE_ARCH_CMPXCHG) doesn't even explicitly include