aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Rutland <[email protected]>2021-05-25 15:02:04 +0100
committerPeter Zijlstra <[email protected]>2021-05-26 13:20:49 +0200
commitf0c7bf1b77c65c9a273207d228df27009f09ec0b (patch)
tree9c8fac2cd31990d2bd2ca33d62c6d9fcd862ec69
parentb68622a86c8f30423c0a09204b1db2b74a06b5f0 (diff)
locking/atomic: openrisc: avoid asm-generic/atomic.h
OpenRISC is the only architecture which uses asm-generic/atomic.h and also provides its own implementation of some functions, requiring ifdeferry in the asm-generic header. As OpenRISC provides the vast majority of functions itself, it would be simpler overall if it also provided the few functions it cribs from asm-generic. This patch decouples OpenRISC from asm-generic/atomic.h. Subsequent patches will simplify the asm-generic implementation and remove the now unnecessary ifdeferry. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <[email protected]> Acked-by: Stafford Horne <[email protected]> Cc: Boqun Feng <[email protected]> Cc: Jonas Bonn <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stefan Kristiansson <[email protected]> Cc: Will Deacon <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--arch/openrisc/include/asm/atomic.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/arch/openrisc/include/asm/atomic.h b/arch/openrisc/include/asm/atomic.h
index b589fac39b92..cb86970d3859 100644
--- a/arch/openrisc/include/asm/atomic.h
+++ b/arch/openrisc/include/asm/atomic.h
@@ -121,6 +121,12 @@ static inline int atomic_fetch_add_unless(atomic_t *v, int a, int u)
}
#define atomic_fetch_add_unless atomic_fetch_add_unless
-#include <asm-generic/atomic.h>
+#define atomic_read(v) READ_ONCE((v)->counter)
+#define atomic_set(v,i) WRITE_ONCE((v)->counter, (i))
+
+#include <asm/cmpxchg.h>
+
+#define atomic_xchg(ptr, v) (xchg(&(ptr)->counter, (v)))
+#define atomic_cmpxchg(v, old, new) (cmpxchg(&((v)->counter), (old), (new)))
#endif /* __ASM_OPENRISC_ATOMIC_H */