diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2019-07-16 16:26:42 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-16 19:23:21 -0700 |
commit | ce251e0e3c0597ea8cab5787df579bd1f9c1aca1 (patch) | |
tree | 87e3c6a3833e52cf72f06a97f4808eee7267b77b /include/linux/kernel.h | |
parent | c6c405336bd3b0ebd1d76aaf9ea88b35dba77e61 (diff) | |
download | linux-ce251e0e3c0597ea8cab5787df579bd1f9c1aca1.tar.gz linux-ce251e0e3c0597ea8cab5787df579bd1f9c1aca1.tar.bz2 linux-ce251e0e3c0597ea8cab5787df579bd1f9c1aca1.zip |
include/linux/kernel.h: add typeof_member() macro
Add typeof_member() macro so that types can be extracted without
introducing dummy variables.
Link: http://lkml.kernel.org/r/20190529190720.GA5703@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r-- | include/linux/kernel.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 0c9bc231107f..4fa360a13c1e 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -88,6 +88,8 @@ */ #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f)) +#define typeof_member(T, m) typeof(((T*)0)->m) + #define DIV_ROUND_UP __KERNEL_DIV_ROUND_UP #define DIV_ROUND_DOWN_ULL(ll, d) \ |