lkml.org 
[lkml]   [2022]   [Dec]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH v7 1/5] module.h: MODULE_DEVICE_TABLE for built-in modules
From
Implement MODULE_DEVICE_TABLE for build-in modules to make it possible
to generate a builtin.alias file to complement modules.alias.

Signed-off-by: Allen Webb <allenwebb@google.com>
---
include/linux/module.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/linux/module.h b/include/linux/module.h
index ec61fb53979a9..49e4019393127 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -243,7 +243,15 @@ extern void cleanup_module(void);
extern typeof(name) __mod_##type##__##name##_device_table \
__attribute__ ((unused, alias(__stringify(name))))
#else /* !MODULE */
-#define MODULE_DEVICE_TABLE(type, name)
+/* The names may not be unique for built-in modules, so include the module name
+ * to guarantee uniqueness.
+ */
+#define MODULE_DEVICE_TABLE(type, name) \
+extern void *CONCATENATE( \
+ CONCATENATE(__mod_##type##__##name##__, \
+ __KBUILD_MODNAME), \
+ _device_table) \
+ __attribute__ ((unused, alias(__stringify(name))))
#endif

/* Version of form [<epoch>:]<version>[-<extra-version>].
--
2.37.3
\
 
 \ /
  Last update: 2022-12-16 23:18    [W:0.190 / U:0.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site