[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211120130104.185699-12-alx.manpages@gmail.com>
Date: Sat, 20 Nov 2021 14:00:54 +0100
From: Alejandro Colomar <alx.manpages@...il.com>
To: LKML <linux-kernel@...r.kernel.org>
Cc: Alejandro Colomar <alx.manpages@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Arnd Bergmann <arnd@...db.de>,
Alexey Dobriyan <adobriyan@...il.com>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Rasmus Villemoes <linux@...musvillemoes.dk>,
Kees Cook <keescook@...omium.org>,
Joe Perches <joe@...ches.com>
Subject: [PATCH v2 11/20] 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@...il.com>
---
include/linux/container_of.h | 8 ++++++--
1 file 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
--
2.33.1
Powered by blists - more mailing lists