From: Al Viro a) in smp_lock.h #include of sched.h and spinlock.h moved under #ifdef CONFIG_LOCK_KERNEL. b) interrupt.h now explicitly pulls sched.h (not via smp_lock.h from hardirq.h as it used to) c) in three more places we need changes to compensate for (a) - one place in arch/sparc needs string.h now, hardirq.h needs forward declaration of task_struct and preempt.h needs direct include of thread_info.h. d) thread_info-related helpers in sched.h and thread_info.h put under ifndef __HAVE_THREAD_FUNCTIONS. Obviously safe. Signed-off-by: Al Viro Signed-off-by: Roman Zippel Signed-off-by: Andrew Morton --- arch/sparc/lib/bitext.c | 1 + include/linux/hardirq.h | 2 ++ include/linux/interrupt.h | 1 + include/linux/preempt.h | 1 + include/linux/sched.h | 4 ++++ include/linux/smp_lock.h | 3 +-- 6 files changed, 10 insertions(+), 2 deletions(-) diff -puN arch/sparc/lib/bitext.c~m68k-thread_info-header-cleanup arch/sparc/lib/bitext.c --- devel/arch/sparc/lib/bitext.c~m68k-thread_info-header-cleanup 2005-09-12 03:34:49.000000000 -0700 +++ devel-akpm/arch/sparc/lib/bitext.c 2005-09-12 03:34:49.000000000 -0700 @@ -10,6 +10,7 @@ */ #include +#include #include #include diff -puN include/linux/hardirq.h~m68k-thread_info-header-cleanup include/linux/hardirq.h --- devel/include/linux/hardirq.h~m68k-thread_info-header-cleanup 2005-09-12 03:34:49.000000000 -0700 +++ devel-akpm/include/linux/hardirq.h 2005-09-12 03:34:49.000000000 -0700 @@ -90,6 +90,8 @@ extern void synchronize_irq(unsigned int #define nmi_enter() irq_enter() #define nmi_exit() sub_preempt_count(HARDIRQ_OFFSET) +struct task_struct; + #ifndef CONFIG_VIRT_CPU_ACCOUNTING static inline void account_user_vtime(struct task_struct *tsk) { diff -puN include/linux/interrupt.h~m68k-thread_info-header-cleanup include/linux/interrupt.h --- devel/include/linux/interrupt.h~m68k-thread_info-header-cleanup 2005-09-12 03:34:49.000000000 -0700 +++ devel-akpm/include/linux/interrupt.h 2005-09-12 03:34:49.000000000 -0700 @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include diff -puN include/linux/preempt.h~m68k-thread_info-header-cleanup include/linux/preempt.h --- devel/include/linux/preempt.h~m68k-thread_info-header-cleanup 2005-09-12 03:34:49.000000000 -0700 +++ devel-akpm/include/linux/preempt.h 2005-09-12 03:34:49.000000000 -0700 @@ -7,6 +7,7 @@ */ #include +#include #include #ifdef CONFIG_DEBUG_PREEMPT diff -puN include/linux/sched.h~m68k-thread_info-header-cleanup include/linux/sched.h --- devel/include/linux/sched.h~m68k-thread_info-header-cleanup 2005-09-12 03:34:49.000000000 -0700 +++ devel-akpm/include/linux/sched.h 2005-09-12 03:34:49.000000000 -0700 @@ -1171,6 +1171,8 @@ static inline void task_unlock(struct ta spin_unlock(&p->alloc_lock); } +#ifndef __HAVE_THREAD_FUNCTIONS + #define task_thread_info(task) (task)->thread_info static inline void setup_thread_stack(struct task_struct *p, struct task_struct *org) @@ -1184,6 +1186,8 @@ static inline unsigned long *end_of_stac return (unsigned long *)(p->thread_info + 1); } +#endif + /* set thread flags in other task's structures * - see asm/thread_info.h for TIF_xxxx flags available */ diff -puN include/linux/smp_lock.h~m68k-thread_info-header-cleanup include/linux/smp_lock.h --- devel/include/linux/smp_lock.h~m68k-thread_info-header-cleanup 2005-09-12 03:34:49.000000000 -0700 +++ devel-akpm/include/linux/smp_lock.h 2005-09-12 03:34:49.000000000 -0700 @@ -2,11 +2,10 @@ #define __LINUX_SMPLOCK_H #include +#ifdef CONFIG_LOCK_KERNEL #include #include -#ifdef CONFIG_LOCK_KERNEL - #define kernel_locked() (current->lock_depth >= 0) extern int __lockfunc __reacquire_kernel_lock(void); _