Turn atomic_inc_return and atomic_dec_return atomic.h macros to inline
functions. Adjust README.LinuxPrimitives in the process.
Signed-off-by: Corneliu ZUZU <cz...@bitdefender.com>
Reviewed-by: Stefano Stabellini <sstabell...@kernel.org>
---
Changed since v3:
* update README.LinuxPrimitives file
---
xen/arch/arm/README.LinuxPrimitives | 18 ++++++++++--------
xen/include/asm-arm/atomic.h | 13 ++++++++++---
2 files changed, 20 insertions(+), 11 deletions(-)
diff --git a/xen/arch/arm/README.LinuxPrimitives
b/xen/arch/arm/README.LinuxPrimitives
index 2fcdfa4..efdc00c 100644
--- a/xen/arch/arm/README.LinuxPrimitives
+++ b/xen/arch/arm/README.LinuxPrimitives
@@ -27,13 +27,14 @@ The following functions were taken from Linux:
atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(),
atomic_cmpxchg(), __atomic_add_unless()
-Also, the following macros which were in the meantime moved to asm-arm/atomic.h
-and most of them turned to inline functions:
- atomic_xchg(v, new) [still macro], atomic_inc(v), atomic_dec(v),
+Also, the following macros which were in the meantime moved to
asm-arm/atomic.h:
+ atomic_xchg(v, new), atomic_inc(v), atomic_dec(v),
atomic_inc_and_test(v), atomic_dec_and_test(v),
- atomic_inc_return(v) [still macro], atomic_dec_return(v) [still macro],
+ atomic_inc_return(v), atomic_dec_return(v),
atomic_sub_and_test(i, v), atomic_add_negative(i,v)
+ * Note: all but atomic_xchg() were turned to inline functions
+
---------------------------------------------------------------------
mem*: last sync @ v3.16-rc6 (last commit: d875c9b37240)
@@ -106,13 +107,14 @@ The following functions were taken from Linux:
atomic_add(), atomic_add_return(), atomic_sub(), atomic_sub_return(),
atomic_cmpxchg(), __atomic_add_unless()
-Also, the following macros which were in the meantime moved to asm-arm/atomic.h
-and most of them turned to inline functions:
- atomic_xchg(v, new) [still macro], atomic_inc(v), atomic_dec(v),
+Also, the following macros which were in the meantime moved to
asm-arm/atomic.h:
+ atomic_xchg(v, new), atomic_inc(v), atomic_dec(v),
atomic_inc_and_test(v), atomic_dec_and_test(v),
- atomic_inc_return(v) [still macro], atomic_dec_return(v) [still macro],
+ atomic_inc_return(v), atomic_dec_return(v),
atomic_sub_and_test(i, v), atomic_add_negative(i,v)
+ * Note: all but atomic_xchg() were turned to inline functions
+
---------------------------------------------------------------------
mem*: last sync @ v3.16-rc6 (last commit: d98b90ea22b0)
diff --git a/xen/include/asm-arm/atomic.h b/xen/include/asm-arm/atomic.h
index 78dad29..c69aae6 100644
--- a/xen/include/asm-arm/atomic.h
+++ b/xen/include/asm-arm/atomic.h
@@ -130,9 +130,6 @@ static inline void _atomic_set(atomic_t *v, int i)
# error "unknown ARM variant"
#endif
-#define atomic_inc_return(v) (atomic_add_return(1, v))
-#define atomic_dec_return(v) (atomic_sub_return(1, v))
-
static inline int atomic_sub_and_test(int i, atomic_t *v)
{
return atomic_sub_return(i, v) == 0;
@@ -143,6 +140,11 @@ static inline void atomic_inc(atomic_t *v)
atomic_add(1, v);
}
+static inline int atomic_inc_return(atomic_t *v)
+{
+ return atomic_add_return(1, v);
+}
+
static inline int atomic_inc_and_test(atomic_t *v)
{
return atomic_add_return(1, v) == 0;
@@ -153,6 +155,11 @@ static inline void atomic_dec(atomic_t *v)
atomic_sub(1, v);
}
+static inline int atomic_dec_return(atomic_t *v)
+{
+ return atomic_sub_return(1, v);
+}
+
static inline int atomic_dec_and_test(atomic_t *v)
{
return atomic_sub_return(1, v) == 0;