X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=include%2Flinux%2Fhardirq.h;h=2961ec788046627c823feb291d7d522f15982fbf;hb=0ba6c33bcddc64a54b5f1c25a696c4767dc76292;hp=7803014f3a11bae4f353e7b042c0e1835997c7be;hpb=8a03d9a498eaf02c8a118752050a5154852c13bf;p=linux-2.6 diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h index 7803014f3a..2961ec7880 100644 --- a/include/linux/hardirq.h +++ b/include/linux/hardirq.h @@ -72,12 +72,21 @@ #define in_softirq() (softirq_count()) #define in_interrupt() (irq_count()) -#if defined(CONFIG_PREEMPT) && !defined(CONFIG_PREEMPT_BKL) -# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked()) +#define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) + +#ifdef CONFIG_PREEMPT +# define PREEMPT_CHECK_OFFSET 1 #else -# define in_atomic() ((preempt_count() & ~PREEMPT_ACTIVE) != 0) +# define PREEMPT_CHECK_OFFSET 0 #endif +/* + * Check whether we were atomic before we did preempt_disable(): + * (used by the scheduler) + */ +#define in_atomic_preempt_off() \ + ((preempt_count() & ~PREEMPT_ACTIVE) != PREEMPT_CHECK_OFFSET) + #ifdef CONFIG_PREEMPT # define preemptible() (preempt_count() == 0 && !irqs_disabled()) # define IRQ_EXIT_OFFSET (HARDIRQ_OFFSET-1)