提交 800d68c3 编写于 作者: G Grant Likely 提交者: Paul Mackerras

[POWERPC] Add machine initcall macros

The machine initcall macros allow initcalls to be registered which
test machine_is() before executing the initcall.
Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
Signed-off-by: NPaul Mackerras <paulus@samba.org>
上级 194046a1
......@@ -326,5 +326,28 @@ static inline void log_error(char *buf, unsigned int err_type, int fatal)
ppc_md.log_error(buf, err_type, fatal);
}
#define __define_machine_initcall(mach,level,fn,id) \
static int __init __machine_initcall_##mach##_##fn(void) { \
if (machine_is(mach)) return fn(); \
return 0; \
} \
__define_initcall(level,__machine_initcall_##mach##_##fn,id);
#define machine_core_initcall(mach,fn) __define_machine_initcall(mach,"1",fn,1)
#define machine_core_initcall_sync(mach,fn) __define_machine_initcall(mach,"1s",fn,1s)
#define machine_postcore_initcall(mach,fn) __define_machine_initcall(mach,"2",fn,2)
#define machine_postcore_initcall_sync(mach,fn) __define_machine_initcall(mach,"2s",fn,2s)
#define machine_arch_initcall(mach,fn) __define_machine_initcall(mach,"3",fn,3)
#define machine_arch_initcall_sync(mach,fn) __define_machine_initcall(mach,"3s",fn,3s)
#define machine_subsys_initcall(mach,fn) __define_machine_initcall(mach,"4",fn,4)
#define machine_subsys_initcall_sync(mach,fn) __define_machine_initcall(mach,"4s",fn,4s)
#define machine_fs_initcall(mach,fn) __define_machine_initcall(mach,"5",fn,5)
#define machine_fs_initcall_sync(mach,fn) __define_machine_initcall(mach,"5s",fn,5s)
#define machine_rootfs_initcall(mach,fn) __define_machine_initcall(mach,"rootfs",fn,rootfs)
#define machine_device_initcall(mach,fn) __define_machine_initcall(mach,"6",fn,6)
#define machine_device_initcall_sync(mach,fn) __define_machine_initcall(mach,"6s",fn,6s)
#define machine_late_initcall(mach,fn) __define_machine_initcall(mach,"7",fn,7)
#define machine_late_initcall_sync(mach,fn) __define_machine_initcall(mach,"7s",fn,7s)
#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_MACHDEP_H */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册