[PATCH v2 05/20] linux/container_of.h, linux/typeof_member.h: Split typeof_member() into a separate header

From: Alejandro Colomar
Date: Sat Nov 20 2021 - 08:01:33 EST


Include <linux/typeof_member.h> from <linux/container_of.h> for compatibility.

Signed-off-by: Alejandro Colomar <alx.manpages@xxxxxxxxx>
---
include/linux/container_of.h | 3 ++-
include/linux/typeof_member.h | 9 +++++++++
2 files changed, 11 insertions(+), 1 deletion(-)
create mode 100644 include/linux/typeof_member.h

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 */
--
2.33.1