]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
in_atomic(): document why it is unsuitable for general use
authorJonathan Corbet <corbet@lwn.net>
Fri, 28 Mar 2008 21:15:49 +0000 (14:15 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 28 Mar 2008 21:45:21 +0000 (14:45 -0700)
Discourage people from inappropriately using in_atomic()

Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/hardirq.h

index 49829988bfa02cb85a02e38db87f81d077261060..897f723bd222f73a9c9e72519fe4b8cd14e40f14 100644 (file)
 #define in_softirq()           (softirq_count())
 #define in_interrupt()         (irq_count())
 
+/*
+ * Are we running in atomic context?  WARNING: this macro cannot
+ * always detect atomic context; in particular, it cannot know about
+ * held spinlocks in non-preemptible kernels.  Thus it should not be
+ * used in the general case to determine whether sleeping is possible.
+ * Do not use in_atomic() in driver code.
+ */
 #define in_atomic()            ((preempt_count() & ~PREEMPT_ACTIVE) != 0)
 
 #ifdef CONFIG_PREEMPT