Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kernel: prioritize C atomic functions if selected #33964

Merged
merged 3 commits into from
Apr 2, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ config XTENSA
select HAS_DTS
select USE_SWITCH
select USE_SWITCH_SUPPORTED
select ATOMIC_OPERATIONS_ARCH
imply ATOMIC_OPERATIONS_ARCH
help
Xtensa architecture

Expand Down
10 changes: 5 additions & 5 deletions include/sys/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ typedef void *atomic_ptr_t;

/* Low-level primitives come in several styles: */

#if defined(CONFIG_ATOMIC_OPERATIONS_BUILTIN)
/* Default. See this file for the Doxygen reference: */
#include <sys/atomic_builtin.h>
#if defined(CONFIG_ATOMIC_OPERATIONS_C)
/* Generic-but-slow implementation based on kernel locking and syscalls */
#include <sys/atomic_c.h>
#elif defined(CONFIG_ATOMIC_OPERATIONS_ARCH)
/* Some architectures need their own implementation */
# ifdef CONFIG_XTENSA
/* Not all Xtensa toolchains support GCC-style atomic intrinsics */
# include <arch/xtensa/atomic_xtensa.h>
# endif
#else
/* Generic-but-slow implementation based on kernel locking and syscalls */
#include <sys/atomic_c.h>
/* Default. See this file for the Doxygen reference: */
#include <sys/atomic_builtin.h>
#endif

/* Portable higher-level utilities: */
Expand Down
4 changes: 0 additions & 4 deletions include/sys/atomic_builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,4 @@ static inline atomic_val_t atomic_nand(atomic_t *target, atomic_val_t value)
}
#endif

#ifdef CONFIG_ATOMIC_OPERATIONS_C
#include <syscalls/atomic.h>
#endif

#endif /* ZEPHYR_INCLUDE_SYS_ATOMIC_BUILTIN_H_ */