[RFC v1 1/3] driver-core: split module_init() and module_exit()

From: Luis R. Rodriguez
Date: Sun Aug 31 2014 - 05:03:59 EST


From: "Luis R. Rodriguez" <mcgrof@xxxxxxxx>

module_init() currently is the default caller used
for all other types of *_init() calls for modules.
If we want to do something a bit different for
init groups though we are implicating that onto
the other ones. Lets instead use a generic drv_init()
which maps to what module_init() used to be. For
now module_init() will also map to drv_init() but
the idea is that we'll change this eventually.

Cc: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>
Cc: Arjan van de Ven <arjan@xxxxxxxxxxxxxxx>
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxx>
---
include/linux/init.h | 43 +++++++++++++++++++++++--------------------
1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/include/linux/init.h b/include/linux/init.h
index 2df8e8d..3b69b1a 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -304,37 +304,40 @@ void __init parse_early_options(char *cmdline);
* matter when built as a loadable module. Like bus
* snooping debug drivers.
*/
-#define early_initcall(fn) module_init(fn)
-#define core_initcall(fn) module_init(fn)
-#define core_initcall_sync(fn) module_init(fn)
-#define postcore_initcall(fn) module_init(fn)
-#define postcore_initcall_sync(fn) module_init(fn)
-#define arch_initcall(fn) module_init(fn)
-#define subsys_initcall(fn) module_init(fn)
-#define subsys_initcall_sync(fn) module_init(fn)
-#define fs_initcall(fn) module_init(fn)
-#define fs_initcall_sync(fn) module_init(fn)
-#define rootfs_initcall(fn) module_init(fn)
-#define device_initcall(fn) module_init(fn)
-#define device_initcall_sync(fn) module_init(fn)
-#define late_initcall(fn) module_init(fn)
-#define late_initcall_sync(fn) module_init(fn)
-
-#define console_initcall(fn) module_init(fn)
-#define security_initcall(fn) module_init(fn)
+#define early_initcall(fn) drv_init(fn)
+#define core_initcall(fn) drv_init(fn)
+#define core_initcall_sync(fn) drv_init(fn)
+#define postcore_initcall(fn) drv_init(fn)
+#define postcore_initcall_sync(fn) drv_init(fn)
+#define arch_initcall(fn) drv_init(fn)
+#define subsys_initcall(fn) drv_init(fn)
+#define subsys_initcall_sync(fn) drv_init(fn)
+#define fs_initcall(fn) drv_init(fn)
+#define fs_initcall_sync(fn) drv_init(fn)
+#define rootfs_initcall(fn) drv_init(fn)
+#define device_initcall(fn) drv_init(fn)
+#define device_initcall_sync(fn) drv_init(fn)
+#define late_initcall(fn) drv_init(fn)
+#define late_initcall_sync(fn) drv_init(fn)
+
+#define console_initcall(fn) drv_init(fn)
+#define security_initcall(fn) drv_init(fn)

/* Each module must use one module_init(). */
-#define module_init(initfn) \
+#define drv_init(initfn) \
static inline initcall_t __inittest(void) \
{ return initfn; } \
int init_module(void) __attribute__((alias(#initfn)));

/* This is only required if you want to be unloadable. */
-#define module_exit(exitfn) \
+#define drv_exit(exitfn) \
static inline exitcall_t __exittest(void) \
{ return exitfn; } \
void cleanup_module(void) __attribute__((alias(#exitfn)));

+#define module_init(initfn) drv_init(initfn);
+#define module_exit(exitfn) drv_exit(exitfn);
+
#define __setup_param(str, unique_id, fn) /* nothing */
#define __setup(str, func) /* nothing */
#endif
--
2.0.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/