summaryrefslogtreecommitdiff
path: root/zephyr/shim/include/atomic.h
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2020-10-07 12:13:52 +0200
committerCommit Bot <commit-bot@chromium.org>2020-10-27 09:35:49 +0000
commita05f7b9f469e7c171f4a737968ab5cbd11ba1253 (patch)
treeab128a89ce9206ca967ad104e307d6c0b4c33a52 /zephyr/shim/include/atomic.h
parent3cba51e9e807e7015d81c2891c47ea4c59587a1c (diff)
downloadchrome-ec-a05f7b9f469e7c171f4a737968ab5cbd11ba1253.tar.gz
tree: Use new atomic_* implementation
It is done as a part of porting to Zephyr. Since the implementation of atomic functions is done for all architectures use atomic_* instead of deprecated_atomic_*. Sometimes there was a compilation error "discards 'volatile' qualifier" due to dropping "volatile" in the argument of the functions, thus some pointers casts need to be made. It shouldn't cause any issues, because we are sure about generated asm (store operation will be performed). BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I98f590c323c3af52035e62825e8acfa358e0805a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2478949 Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Diffstat (limited to 'zephyr/shim/include/atomic.h')
-rw-r--r--zephyr/shim/include/atomic.h32
1 files changed, 4 insertions, 28 deletions
diff --git a/zephyr/shim/include/atomic.h b/zephyr/shim/include/atomic.h
index 41260c1238..f3efe18fe8 100644
--- a/zephyr/shim/include/atomic.h
+++ b/zephyr/shim/include/atomic.h
@@ -8,38 +8,14 @@
#include <sys/atomic.h>
-/*
- * Below EC APIs are being deprecated and replaced with the Zephyr
- * APIs. We already get the Zephyr APIs from sys/atomic.h. The
- * definitions here are provided so we can shim-in modules using the
- * deprecated APIs while the transition is under way.
- */
-static inline void deprecated_atomic_clear_bits(uint32_t volatile *addr,
- uint32_t bits)
-{
- atomic_and((atomic_t *)addr, bits);
-}
-
-static inline void deprecated_atomic_or(uint32_t volatile *addr, uint32_t bits)
-{
- atomic_or((atomic_t *)addr, bits);
-}
-
-static inline void deprecated_atomic_add(uint32_t volatile *addr,
- uint32_t value)
-{
- atomic_add((atomic_t *)addr, value);
-}
-
-static inline void deprecated_atomic_sub(uint32_t volatile *addr,
- uint32_t value)
+static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
{
- atomic_sub((atomic_t *)addr, value);
+ atomic_and(addr, ~bits);
}
-static inline uint32_t deprecated_atomic_read_clear(uint32_t volatile *addr)
+static inline atomic_val_t atomic_read_clear(atomic_t *addr)
{
- return atomic_clear((atomic_t *)addr);
+ return atomic_clear(addr);
}
#endif /* __CROS_EC_ATOMIC_H */