Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

locking/atomics, cmpxchg: Privatize the inclusion of asm/cmpxchg.h

After commit:

654672d4ba1a ("locking/atomics: Add _{acquire|release|relaxed}() variants of some atomic operations")

Architectures may only provide {cmp,}xchg_relaxed definitions in
asm/cmpxchg.h. Other variants, such as {cmp,}xchg, may be built in
linux/atomic.h, which means simply including asm/cmpxchg.h may not get
the definitions of all the{cmp,}xchg variants.

Therefore, we should privatize the inclusions of asm/cmpxchg.h to
keep it only included in arch/* and replace the inclusions outside
with linux/atomic.h

Signed-off-by: Boqun Feng <boqun.feng@gmail.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Aybuke Ozdemir <aybuke.147@gmail.com>
Cc: Chris Brannon <chris@the-brannons.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Kirk Reiser <kirk@reisers.ca>
Cc: Kishon Vijay Abraham I <kishon@ti.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Samuel Thibault <samuel.thibault@ens-lyon.org>
Cc: Shradha Shah <sshah@solarflare.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: William Hubbs <w.d.hubbs@gmail.com>
Cc: devel@driverdev.osuosl.org
Cc: linux-net-drivers@solarflare.com
Cc: speakup@linux-speakup.org
Link: http://lkml.kernel.org/r/1440589966-26280-1-git-send-email-boqun.feng@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Boqun Feng and committed by
Ingo Molnar
84567995 c7ef92ce

+7 -4
+4
Documentation/atomic_ops.txt
··· 542 542 memory-barrier semantics as the atomic and bit operations returning 543 543 values. 544 544 545 + Note: If someone wants to use xchg(), cmpxchg() and their variants, 546 + linux/atomic.h should be included rather than asm/cmpxchg.h, unless 547 + the code is in arch/* and can take care of itself. 548 + 545 549 Spinlocks and rwlocks have memory barrier expectations as well. 546 550 The rule to follow is simple: 547 551
+1 -1
drivers/net/ethernet/sfc/mcdi.c
··· 9 9 10 10 #include <linux/delay.h> 11 11 #include <linux/moduleparam.h> 12 - #include <asm/cmpxchg.h> 12 + #include <linux/atomic.h> 13 13 #include "net_driver.h" 14 14 #include "nic.h" 15 15 #include "io.h"
+1 -2
drivers/phy/phy-rcar-gen2.c
··· 17 17 #include <linux/phy/phy.h> 18 18 #include <linux/platform_device.h> 19 19 #include <linux/spinlock.h> 20 - 21 - #include <asm/cmpxchg.h> 20 + #include <linux/atomic.h> 22 21 23 22 #define USBHS_LPSTS 0x02 24 23 #define USBHS_UGCTRL 0x80
+1 -1
drivers/staging/speakup/selection.c
··· 7 7 #include <linux/workqueue.h> 8 8 #include <linux/tty.h> 9 9 #include <linux/tty_flip.h> 10 - #include <asm/cmpxchg.h> 10 + #include <linux/atomic.h> 11 11 12 12 #include "speakup.h" 13 13