Message ID | 20230820195222.279069-1-alx@kernel.org |
---|---|
State | New |
Headers | show |
Series | linux/container_of.h: Add memberof() | expand |
diff --git a/include/linux/container_of.h b/include/linux/container_of.h index 713890c867be..5e762025c780 100644 --- a/include/linux/container_of.h +++ b/include/linux/container_of.h @@ -5,7 +5,9 @@ #include <linux/build_bug.h> #include <linux/stddef.h> -#define typeof_member(T, m) typeof(((T*)0)->m) + +#define memberof(T, member) ((T){}.member) +#define typeof_member(T, m) typeof(memberof(T, m)) /** * container_of - cast a member of a structure out to the containing structure