diff options
author | Alejandro Colomar <alx.manpages@gmail.com> | 2021-11-19 16:30:40 +0100 |
---|---|---|
committer | Alejandro Colomar <alx.manpages@gmail.com> | 2021-11-20 13:21:59 +0100 |
commit | 864373a244462af3b0cb32ce0a98df74b1965e87 (patch) | |
tree | 7ad08b05fb1333e1563fe5bcf21cb7f8719d670e | |
parent | 0fb2e646fd033c3a6389ef289d79150f93e683f8 (diff) |
linux/container_of.h, linux/typeof_member.h: Split typeof_member() into a separate header
Include <linux/typeof_member.h> from <linux/container_of.h> for compatibility.
Signed-off-by: Alejandro Colomar <alx.manpages@gmail.com>
-rw-r--r-- | include/linux/container_of.h | 3 | ||||
-rw-r--r-- | include/linux/typeof_member.h | 9 |
2 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/container_of.h b/include/linux/container_of.h index 2f4944b791b8..220990db7b61 100644 --- a/include/linux/container_of.h +++ b/include/linux/container_of.h @@ -2,10 +2,11 @@ #ifndef _LINUX_CONTAINER_OF_H #define _LINUX_CONTAINER_OF_H + #include <linux/build_bug.h> #include <linux/err.h> +#include <linux/typeof_member.h> -#define typeof_member(T, m) typeof(((T*)0)->m) /** * container_of - cast a member of a structure out to the containing structure diff --git a/include/linux/typeof_member.h b/include/linux/typeof_member.h new file mode 100644 index 000000000000..1f3bfb3c17d2 --- /dev/null +++ b/include/linux/typeof_member.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_TYPEOF_MEMBER_H +#define _LINUX_TYPEOF_MEMBER_H + + +#define typeof_member(T, m) typeof(((T *)0)->m) + + +#endif /* _LINUX_TYPEOF_MEMBER_H */ |