diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2007-12-02 01:10:28 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2007-12-20 00:11:46 -0500 |
commit | 800d68c3aa0dc3e31a87f1499d63359caa77441c (patch) | |
tree | 8a80f1412c2a5739b06851e5484d74cb85f2d5ee /include/asm-powerpc/machdep.h | |
parent | 194046a17ee2600908541bc9cd5d6d421805f132 (diff) |
[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: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'include/asm-powerpc/machdep.h')
-rw-r--r-- | include/asm-powerpc/machdep.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/asm-powerpc/machdep.h b/include/asm-powerpc/machdep.h index 6968f4300dca..d5cd98214fab 100644 --- a/include/asm-powerpc/machdep.h +++ b/include/asm-powerpc/machdep.h | |||
@@ -326,5 +326,28 @@ static inline void log_error(char *buf, unsigned int err_type, int fatal) | |||
326 | ppc_md.log_error(buf, err_type, fatal); | 326 | ppc_md.log_error(buf, err_type, fatal); |
327 | } | 327 | } |
328 | 328 | ||
329 | #define __define_machine_initcall(mach,level,fn,id) \ | ||
330 | static int __init __machine_initcall_##mach##_##fn(void) { \ | ||
331 | if (machine_is(mach)) return fn(); \ | ||
332 | return 0; \ | ||
333 | } \ | ||
334 | __define_initcall(level,__machine_initcall_##mach##_##fn,id); | ||
335 | |||
336 | #define machine_core_initcall(mach,fn) __define_machine_initcall(mach,"1",fn,1) | ||
337 | #define machine_core_initcall_sync(mach,fn) __define_machine_initcall(mach,"1s",fn,1s) | ||
338 | #define machine_postcore_initcall(mach,fn) __define_machine_initcall(mach,"2",fn,2) | ||
339 | #define machine_postcore_initcall_sync(mach,fn) __define_machine_initcall(mach,"2s",fn,2s) | ||
340 | #define machine_arch_initcall(mach,fn) __define_machine_initcall(mach,"3",fn,3) | ||
341 | #define machine_arch_initcall_sync(mach,fn) __define_machine_initcall(mach,"3s",fn,3s) | ||
342 | #define machine_subsys_initcall(mach,fn) __define_machine_initcall(mach,"4",fn,4) | ||
343 | #define machine_subsys_initcall_sync(mach,fn) __define_machine_initcall(mach,"4s",fn,4s) | ||
344 | #define machine_fs_initcall(mach,fn) __define_machine_initcall(mach,"5",fn,5) | ||
345 | #define machine_fs_initcall_sync(mach,fn) __define_machine_initcall(mach,"5s",fn,5s) | ||
346 | #define machine_rootfs_initcall(mach,fn) __define_machine_initcall(mach,"rootfs",fn,rootfs) | ||
347 | #define machine_device_initcall(mach,fn) __define_machine_initcall(mach,"6",fn,6) | ||
348 | #define machine_device_initcall_sync(mach,fn) __define_machine_initcall(mach,"6s",fn,6s) | ||
349 | #define machine_late_initcall(mach,fn) __define_machine_initcall(mach,"7",fn,7) | ||
350 | #define machine_late_initcall_sync(mach,fn) __define_machine_initcall(mach,"7s",fn,7s) | ||
351 | |||
329 | #endif /* __KERNEL__ */ | 352 | #endif /* __KERNEL__ */ |
330 | #endif /* _ASM_POWERPC_MACHDEP_H */ | 353 | #endif /* _ASM_POWERPC_MACHDEP_H */ |