[PATCH 6/9] include: Carve <linux/export.h> out of compat.h
Pierre-Clément Tosi
ptosi at google.com
Wed Mar 16 16:39:45 CET 2022
As Linux source code might include that header directly and as it is a
simple "leaf header" (probably won't include other headers) that is
unlikely to be relevant to U-Boot, replicate the upstream header
definitions in a dedicated <linux/export.h> and include it in the
pre-existing compat.h for existing users.
Signed-off-by: Pierre-Clément Tosi <ptosi at google.com>
Cc: Simon Glass <sjg at chromium.org>
Cc: Tom Rini <trini at konsulko.com>
---
include/linux/compat.h | 4 +---
include/linux/export.h | 25 +++++++++++++++++++++++++
2 files changed, 26 insertions(+), 3 deletions(-)
create mode 100644 include/linux/export.h
diff --git a/include/linux/compat.h b/include/linux/compat.h
index 3d0acbd582..d34f2ebdf4 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -9,6 +9,7 @@
#include <linux/types.h>
#include <linux/err.h>
+#include <linux/export.h>
#include <linux/kernel.h>
#ifdef CONFIG_XEN
@@ -175,13 +176,10 @@ typedef unsigned long blkcnt_t;
#endif
/* module */
-#define THIS_MODULE 0
#define try_module_get(...) 1
#define module_put(...) do { } while (0)
#define module_init(...)
#define module_exit(...)
-#define EXPORT_SYMBOL(...)
-#define EXPORT_SYMBOL_GPL(...)
#define module_param(...)
#define module_param_call(...)
#define MODULE_PARM_DESC(...)
diff --git a/include/linux/export.h b/include/linux/export.h
new file mode 100644
index 0000000000..31111bcd35
--- /dev/null
+++ b/include/linux/export.h
@@ -0,0 +1,25 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _LINUX_EXPORT_H
+#define _LINUX_EXPORT_H
+
+/*
+ * Export symbols from the kernel to modules. Forked from module.h
+ * to reduce the amount of pointless cruft we feed to gcc when only
+ * exporting a simple symbol or two.
+ *
+ * Try not to add #includes here. It slows compilation and makes kernel
+ * hackers place grumpy comments in header files.
+ */
+
+#ifndef __ASSEMBLY__
+
+#define THIS_MODULE 0
+
+#define EXPORT_SYMBOL(...)
+#define EXPORT_SYMBOL_GPL(...)
+#define EXPORT_SYMBOL_NS(...)
+#define EXPORT_SYMBOL_NS_GPL(...)
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* _LINUX_EXPORT_H */
--
2.35.1.723.g4982287a31-goog
More information about the U-Boot
mailing list