aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorPetri Savolainen <petri.savolainen@nokia.com>2016-01-20 11:19:22 +0200
committerMaxim Uvarov <maxim.uvarov@linaro.org>2016-02-08 20:45:24 +0300
commit8a27a4a6c8287d54f79a75bf5acab4ee8e03572b (patch)
tree4f750347fd1eaeb8f59fcf3c7f1e097558c2afe0 /platform
parent711508a88bbe513d5840159987e0f74ce1e53524 (diff)
linux-generic: atomic: 32bit cas_rel and cas_acq_rel
Implemented 32bit cas_rel and cas_acq_rel calls. Signed-off-by: Petri Savolainen <petri.savolainen@nokia.com> Reviewed-by: Ola Liljedahl <ola.liljedahl@linaro.org> Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
Diffstat (limited to 'platform')
-rw-r--r--platform/linux-generic/include/odp/atomic.h37
1 files changed, 28 insertions, 9 deletions
diff --git a/platform/linux-generic/include/odp/atomic.h b/platform/linux-generic/include/odp/atomic.h
index 4756fcb60..f1ba20ff5 100644
--- a/platform/linux-generic/include/odp/atomic.h
+++ b/platform/linux-generic/include/odp/atomic.h
@@ -278,15 +278,6 @@ static inline uint32_t odp_atomic_load_acq_u32(odp_atomic_u32_t *atom)
return __atomic_load_n(&atom->v, __ATOMIC_ACQUIRE);
}
-static inline int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom,
- uint32_t *old_val, uint32_t new_val)
-{
- return __atomic_compare_exchange_n(&atom->v, old_val, new_val,
- 0 /* strong */,
- __ATOMIC_ACQUIRE,
- __ATOMIC_RELAXED);
-}
-
static inline void odp_atomic_store_rel_u32(odp_atomic_u32_t *atom,
uint32_t val)
{
@@ -305,6 +296,34 @@ static inline void odp_atomic_sub_rel_u32(odp_atomic_u32_t *atom,
(void)__atomic_fetch_sub(&atom->v, val, __ATOMIC_RELEASE);
}
+static inline int odp_atomic_cas_acq_u32(odp_atomic_u32_t *atom,
+ uint32_t *old_val, uint32_t new_val)
+{
+ return __atomic_compare_exchange_n(&atom->v, old_val, new_val,
+ 0 /* strong */,
+ __ATOMIC_ACQUIRE,
+ __ATOMIC_RELAXED);
+}
+
+static inline int odp_atomic_cas_rel_u32(odp_atomic_u32_t *atom,
+ uint32_t *old_val, uint32_t new_val)
+{
+ return __atomic_compare_exchange_n(&atom->v, old_val, new_val,
+ 0 /* strong */,
+ __ATOMIC_RELEASE,
+ __ATOMIC_RELAXED);
+}
+
+static inline int odp_atomic_cas_acq_rel_u32(odp_atomic_u32_t *atom,
+ uint32_t *old_val,
+ uint32_t new_val)
+{
+ return __atomic_compare_exchange_n(&atom->v, old_val, new_val,
+ 0 /* strong */,
+ __ATOMIC_ACQ_REL,
+ __ATOMIC_RELAXED);
+}
+
/**
* @}
*/