From: Andrew Morton init/main.c: In function `start_kernel': init/main.c:452: warning: implicit declaration of function `trylock_kernel' ... init/built-in.o: In function `start_kernel': undefined reference to `trylock_kernel' Cc: Ingo Molnar Signed-off-by: Andrew Morton --- include/linux/smp_lock.h | 11 ++++++++--- lib/kernel_lock.c | 6 ++++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff -puN include/linux/smp_lock.h~add-trylock_kernel-fix include/linux/smp_lock.h --- devel/include/linux/smp_lock.h~add-trylock_kernel-fix 2006-01-19 23:07:24.000000000 -0800 +++ devel-akpm/include/linux/smp_lock.h 2006-01-19 23:07:24.000000000 -0800 @@ -42,7 +42,7 @@ extern void __lockfunc lock_kernel(void) extern int __lockfunc trylock_kernel(void); extern void __lockfunc unlock_kernel(void) __releases(kernel_lock); -#else +#else /* CONFIG_LOCK_KERNEL */ #define lock_kernel() do { } while(0) #define unlock_kernel() do { } while(0) @@ -50,5 +50,10 @@ extern void __lockfunc unlock_kernel(voi #define reacquire_kernel_lock(task) 0 #define kernel_locked() 1 -#endif /* CONFIG_LOCK_KERNEL */ -#endif /* __LINUX_SMPLOCK_H */ +static inline int trylock_kernel(void) +{ + return 1; +} + +#endif /* CONFIG_LOCK_KERNEL */ +#endif /* __LINUX_SMPLOCK_H */ diff -puN lib/kernel_lock.c~add-trylock_kernel-fix lib/kernel_lock.c --- devel/lib/kernel_lock.c~add-trylock_kernel-fix 2006-01-19 23:07:24.000000000 -0800 +++ devel-akpm/lib/kernel_lock.c 2006-01-19 23:07:24.000000000 -0800 @@ -76,6 +76,9 @@ void __lockfunc lock_kernel(void) task->lock_depth = depth; } +/* + * Returns non-zero if the lock was acquired + */ int __lockfunc trylock_kernel(void) { struct task_struct *task = current; @@ -211,6 +214,9 @@ void __lockfunc lock_kernel(void) current->lock_depth = depth; } +/* + * Returns non-zero if the lock was acquired + */ int __lockfunc trylock_kernel(void) { struct task_struct *task = current; _