The WRITE_ONCE macro is identically defined both in bpf_atomic.h and in bpf_arena_common.h. The bpf_arena_common.h definition is guarded with an ifndef to allow for inclusion after bpf_atomic.h, but the opposite does not hold. Add an extra guard to avoid requiring a specific order for the headers. Signed-off-by: Emil Tsalapatis (Meta) --- tools/testing/selftests/bpf/bpf_atomic.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/testing/selftests/bpf/bpf_atomic.h b/tools/testing/selftests/bpf/bpf_atomic.h index c550e5711967..d89a22d63c1c 100644 --- a/tools/testing/selftests/bpf/bpf_atomic.h +++ b/tools/testing/selftests/bpf/bpf_atomic.h @@ -42,7 +42,9 @@ extern bool CONFIG_X86_64 __kconfig __weak; #define READ_ONCE(x) (*(volatile typeof(x) *)&(x)) +#ifndef WRITE_ONCE #define WRITE_ONCE(x, val) ((*(volatile typeof(x) *)&(x)) = (val)) +#endif #define cmpxchg(p, old, new) __sync_val_compare_and_swap((p), old, new) -- 2.47.3