summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2021-11-19 18:08:38 +0100
committerAlejandro Colomar <alx.manpages@gmail.com>2021-11-20 13:22:21 +0100
commit54f38f52a7384222be20b927a8cab3bf7ac6ea55 (patch)
tree2f1210f2c0b6384366ebe2f0daff50204f264766
parentf9de58ce29f42b2dcdba693e45d46ce888e53ff3 (diff)
linux/container_of.h: Cosmetic
Place braces in a ({}) expression similarly to how a function would have them. Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r--include/linux/container_of.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/include/linux/container_of.h b/include/linux/container_of.h
index 682a2a606ee9..3a31b6874944 100644
--- a/include/linux/container_of.h
+++ b/include/linux/container_of.h
@@ -16,12 +16,16 @@
* @member: the name of the member within the struct.
*
*/
-#define container_of(ptr, type, member) ({ \
+#define container_of(ptr, type, member) ( \
+{ \
const void *__mptr = (ptr); \
+ \
static_assert(__same_type(*(ptr), memberof(type, member)) || \
__same_type(*(ptr), void), \
"pointer type mismatch in container_of()"); \
- ((type *)(__mptr - offsetof(type, member))); })
+ ((type *)(__mptr - offsetof(type, member))); \
+} \
+)
/**
* container_of_safe - cast a member of a structure out to the containing structure