]> git.hungrycats.org Git - linux/commitdiff
[PATCH] ppc32: Fix preemptible check
authorPaul Mackerras <paulus@samba.org>
Thu, 3 Jun 2004 01:22:08 +0000 (18:22 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 3 Jun 2004 01:22:08 +0000 (18:22 -0700)
Ben H added a check in a couple of places to make sure that we had
preemption disabled when we call enable_kernel_{fp,altivec}.
Unfortunately the check he used trips in the case when
CONFIG_PREEMPT=n.  This patch fixes it by defining a preemptible()
macro (which reduces to 0 when CONFIG_PREEMPT=n) and doing
WARN_ON(preemptible()).

Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/ppc/kernel/process.c
include/asm-ppc/hardirq.h

index 19515a1f9734f3f81cdce6f1dc12a83e0689aa99..b82a2009e83f9618d90ebd330124b1ede8afcfad 100644 (file)
@@ -163,7 +163,7 @@ dump_altivec(struct pt_regs *regs, elf_vrregset_t *vrregs)
 void
 enable_kernel_altivec(void)
 {
-       WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled());
+       WARN_ON(preemptible());
 
 #ifdef CONFIG_SMP
        if (current->thread.regs && (current->thread.regs->msr & MSR_VEC))
@@ -180,7 +180,7 @@ EXPORT_SYMBOL(enable_kernel_altivec);
 void
 enable_kernel_fp(void)
 {
-       WARN_ON(current_thread_info()->preempt_count == 0 && !irqs_disabled());
+       WARN_ON(preemptible());
 
 #ifdef CONFIG_SMP
        if (current->thread.regs && (current->thread.regs->msr & MSR_FP))
index 8f4f12a46f7435259f76731bd4ee24bab90b8c12..2531c3bdb5bfa9257e58d9cf9c616b3082f3b5d1 100644 (file)
@@ -83,11 +83,15 @@ typedef struct {
 
 #ifdef CONFIG_PREEMPT
 # define in_atomic()   ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())
+# define preemptible() (preempt_count() == 0 && !irqs_disabled())
 # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)
+
 #else
 # define in_atomic()   (preempt_count() != 0)
+# define preemptible() 0
 # define IRQ_EXIT_OFFSET HARDIRQ_OFFSET
 #endif
+
 #define irq_exit()                                                     \
 do {                                                                   \
        preempt_count() -= IRQ_EXIT_OFFSET;                             \