[PATCH 31/35] common: Move check_member() to kernel.h

Simon Glass sjg at chromium.org
Thu Dec 12 01:47:50 CET 2019


The kernel.h file has a number of useful macros including a few related
to structures. Move check_member() there too.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 include/common.h       | 11 -----------
 include/linux/kernel.h | 11 +++++++++++
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/include/common.h b/include/common.h
index ca08db0467..4110f75a93 100644
--- a/include/common.h
+++ b/include/common.h
@@ -73,17 +73,6 @@
 
 #define ROUND(a,b)		(((a) + (b) - 1) & ~((b) - 1))
 
-/*
- * check_member() - Check the offset of a structure member
- *
- * @structure:	Name of structure (e.g. global_data)
- * @member:	Name of member (e.g. baudrate)
- * @offset:	Expected offset in bytes
- */
-#define check_member(structure, member, offset) _Static_assert( \
-	offsetof(struct structure, member) == offset, \
-	"`struct " #structure "` offset for `" #member "` is not " #offset)
-
 /* Pull in stuff for the build system */
 #ifdef DO_DEPS_ONLY
 # include <env_internal.h>
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 564819a1c0..fefbc07375 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -268,4 +268,15 @@
 	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
 	(type *)( (char *)__mptr - offsetof(type,member) );})
 
+/*
+ * check_member() - Check the offset of a structure member
+ *
+ * @structure:	Name of structure (e.g. global_data)
+ * @member:	Name of member (e.g. baudrate)
+ * @offset:	Expected offset in bytes
+ */
+#define check_member(structure, member, offset) _Static_assert( \
+	offsetof(struct structure, member) == (offset), \
+	"`struct " #structure "` offset for `" #member "` is not " #offset)
+
 #endif
-- 
2.24.0.525.g8f36a354ae-goog



More information about the U-Boot mailing list