mirror of https://gitee.com/openkylin/linux.git
final init.h ---> module.h code relocation
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABAgAGBQJVou0MAAoJEOvOhAQsB9HWrTcQAIptAvZQldKDjt0C6B9WNJlX YJ/HsoFPv3LXizBSH1T8OhMiV04b5bQoTxVIbZwbYHr7DCCRNhswKz+Yn4EGCw5v PiyihxWPPYeXO9mtxS1cmuiQ78GlUl0ilNPkDI4NsQSISgrz4hj5dr3dZLj2Wcv1 pZqux5rrgJf06aoFD/7avS+e31HoLvglTrFnu0jdBs3G/lrjk0bjLX3PXFi2ACT7 eD20rRskpgOIQBk6AjL4Pqq1fpcWIRNwF5CCdgg4SaDP5W3kFhpanRKfHtovYbQ4 AC79M8SwDRGphNu0QJRtESeM9vpFNx0/9i+sbXRfbgbr/mDPbUCSaKvCdqDXVFHN gp7u6bQKx1KoDfWCFM9KTF7KBST0cSk1YMUtWWaWWZp0f8mih9elpWja8anGlHe1 PlDY/BKGMpbrac1oVSzBmiT50b73C2BOrt9zAi/IrEwnQzmi2lvtnmYFLNhJhjjM aSntD0OmSD8sJcjB98a/cxOrKsFEpt93C/sGSvZ8M4MWOziQQUtY2ryhNdH0utmL QYqDaqoyuImvtwEBvidgVdNbOonNpBHljiPBgkDAtv6aMzxlrWrGGMaZlrWi0FDZ S+tllpwGDXfAshZOmE0yZEwpQL7vjb3y31G+TrwKKXJvsczRaK5o4Mc8LELxqS/n oAbZOMdu8Zy3ugTa5NDF =TcF6 -----END PGP SIGNATURE----- Merge tag 'module-final-v4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux Pull final init.h/module.h code relocation from Paul Gortmaker: "With the release of 4.2-rc2 done, we should not be seeing any new code added that gets upset by this small code move, and we've banked yet another complete week of testing with this move in place on top of 4.2-rc1 via linux-next to ensure that remained true. Given that, I'd like to put it in now so that people formulating new work for 4.3-rc1 will be exposed to the ever so slightly stricter (but sensible) requirements wrt. whether they are needing init.h vs. module.h macros, even if they are not using linux-next. The diffstat of the move is slightly asymmetrical due to needing to leave behind a couple #ifdef in the old location and add the same ones to the new location, but other than that, it is a 1:1 move, complete with the module_init/exit trailing semicolon that we can't fix. That is, until/unless someone does a tree-wide sed fix of all the approximately 800 currently in tree users relying on it" * tag 'module-final-v4.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/paulg/linux: module: relocate module_init from init.h to module.h
This commit is contained in:
commit
97d6e2b636
|
@ -282,68 +282,8 @@ void __init parse_early_param(void);
|
|||
void __init parse_early_options(char *cmdline);
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
/**
|
||||
* module_init() - driver initialization entry point
|
||||
* @x: function to be run at kernel boot time or module insertion
|
||||
*
|
||||
* module_init() will either be called during do_initcalls() (if
|
||||
* builtin) or at module insertion time (if a module). There can only
|
||||
* be one per module.
|
||||
*/
|
||||
#define module_init(x) __initcall(x);
|
||||
|
||||
/**
|
||||
* module_exit() - driver exit entry point
|
||||
* @x: function to be run when driver is removed
|
||||
*
|
||||
* module_exit() will wrap the driver clean-up code
|
||||
* with cleanup_module() when used with rmmod when
|
||||
* the driver is a module. If the driver is statically
|
||||
* compiled into the kernel, module_exit() has no effect.
|
||||
* There can only be one per module.
|
||||
*/
|
||||
#define module_exit(x) __exitcall(x);
|
||||
|
||||
#else /* MODULE */
|
||||
|
||||
/*
|
||||
* In most cases loadable modules do not need custom
|
||||
* initcall levels. There are still some valid cases where
|
||||
* a driver may be needed early if built in, and does not
|
||||
* 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)
|
||||
|
||||
/* Each module must use one module_init(). */
|
||||
#define module_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) \
|
||||
static inline exitcall_t __exittest(void) \
|
||||
{ return exitfn; } \
|
||||
void cleanup_module(void) __attribute__((alias(#exitfn)));
|
||||
|
||||
#define __setup_param(str, unique_id, fn) /* nothing */
|
||||
#define __setup(str, func) /* nothing */
|
||||
#endif
|
||||
|
@ -351,24 +291,6 @@ void __init parse_early_options(char *cmdline);
|
|||
/* Data marked not to be saved by software suspend */
|
||||
#define __nosavedata __section(.data..nosave)
|
||||
|
||||
/* This means "can be init if no module support, otherwise module load
|
||||
may call it." */
|
||||
#ifdef CONFIG_MODULES
|
||||
#define __init_or_module
|
||||
#define __initdata_or_module
|
||||
#define __initconst_or_module
|
||||
#define __INIT_OR_MODULE .text
|
||||
#define __INITDATA_OR_MODULE .data
|
||||
#define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits
|
||||
#else
|
||||
#define __init_or_module __init
|
||||
#define __initdata_or_module __initdata
|
||||
#define __initconst_or_module __initconst
|
||||
#define __INIT_OR_MODULE __INIT
|
||||
#define __INITDATA_OR_MODULE __INITDATA
|
||||
#define __INITRODATA_OR_MODULE __INITRODATA
|
||||
#endif /*CONFIG_MODULES*/
|
||||
|
||||
#ifdef MODULE
|
||||
#define __exit_p(x) x
|
||||
#else
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <linux/compiler.h>
|
||||
#include <linux/cache.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/elf.h>
|
||||
#include <linux/stringify.h>
|
||||
#include <linux/kobject.h>
|
||||
|
@ -71,6 +72,89 @@ extern struct module_attribute module_uevent;
|
|||
extern int init_module(void);
|
||||
extern void cleanup_module(void);
|
||||
|
||||
#ifndef MODULE
|
||||
/**
|
||||
* module_init() - driver initialization entry point
|
||||
* @x: function to be run at kernel boot time or module insertion
|
||||
*
|
||||
* module_init() will either be called during do_initcalls() (if
|
||||
* builtin) or at module insertion time (if a module). There can only
|
||||
* be one per module.
|
||||
*/
|
||||
#define module_init(x) __initcall(x);
|
||||
|
||||
/**
|
||||
* module_exit() - driver exit entry point
|
||||
* @x: function to be run when driver is removed
|
||||
*
|
||||
* module_exit() will wrap the driver clean-up code
|
||||
* with cleanup_module() when used with rmmod when
|
||||
* the driver is a module. If the driver is statically
|
||||
* compiled into the kernel, module_exit() has no effect.
|
||||
* There can only be one per module.
|
||||
*/
|
||||
#define module_exit(x) __exitcall(x);
|
||||
|
||||
#else /* MODULE */
|
||||
|
||||
/*
|
||||
* In most cases loadable modules do not need custom
|
||||
* initcall levels. There are still some valid cases where
|
||||
* a driver may be needed early if built in, and does not
|
||||
* 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)
|
||||
|
||||
/* Each module must use one module_init(). */
|
||||
#define module_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) \
|
||||
static inline exitcall_t __exittest(void) \
|
||||
{ return exitfn; } \
|
||||
void cleanup_module(void) __attribute__((alias(#exitfn)));
|
||||
|
||||
#endif
|
||||
|
||||
/* This means "can be init if no module support, otherwise module load
|
||||
may call it." */
|
||||
#ifdef CONFIG_MODULES
|
||||
#define __init_or_module
|
||||
#define __initdata_or_module
|
||||
#define __initconst_or_module
|
||||
#define __INIT_OR_MODULE .text
|
||||
#define __INITDATA_OR_MODULE .data
|
||||
#define __INITRODATA_OR_MODULE .section ".rodata","a",%progbits
|
||||
#else
|
||||
#define __init_or_module __init
|
||||
#define __initdata_or_module __initdata
|
||||
#define __initconst_or_module __initconst
|
||||
#define __INIT_OR_MODULE __INIT
|
||||
#define __INITDATA_OR_MODULE __INITDATA
|
||||
#define __INITRODATA_OR_MODULE __INITRODATA
|
||||
#endif /*CONFIG_MODULES*/
|
||||
|
||||
/* Archs provide a method of finding the correct exception table. */
|
||||
struct exception_table_entry;
|
||||
|
||||
|
|
Loading…
Reference in New Issue