From f41c421482002ee4f395918b88f77d4b50305aee Mon Sep 17 00:00:00 2001 From: Szymon Janc Date: Thu, 21 May 2026 14:02:36 +0200 Subject: [PATCH] kernel/os: Check if CONTAINER_OF is already defined Check if CONTAINER_OF is already defined before defining in the OS. This is quite common macro name and may cause macro redefine error otherwise. --- kernel/os/include/os/util.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/os/include/os/util.h b/kernel/os/include/os/util.h index 3e59670c4e..f272a0a342 100644 --- a/kernel/os/include/os/util.h +++ b/kernel/os/include/os/util.h @@ -27,8 +27,10 @@ #define INT_TO_POINTER(u) ((void *) ((intptr_t) (u))) /* Helper to retrieve pointer to "parent" object in structure */ +#ifndef CONTAINER_OF #define CONTAINER_OF(ptr, type, field) \ ((type *)(((char *)(ptr)) - offsetof(type, field))) +#endif /* Helper to calculate number of elements in array */ #ifndef ARRAY_SIZE