Strange in_atomic() definition in include/linux/hardirq.h

From: Nikita V. Youshchenko
Date: Sat Nov 20 2004 - 14:33:23 EST


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello.

In linux 2.6.9, in include/linux/hardirq.h, if CONFIG_PREEMPT is set,
isw_atomic() is defines as

#define in_atomic()
((preempt_count() & ~PREEMPT_ACTIVE) != kernel_locked())

preempt_count (after PREEMPT_ACTIVE is cleared out) looks to be an integer
counter, increased in preempt_disable() and increased in preempt_enable().

kernel_locked() is defined in include/linux/smp_lock.h as
#define kernel_locked() (current->lock_depth >= 0)

So in in_atomic() definition, integer counter is compared with boolean
value. Looks like a bug.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFBn5vOv3x5OskTLdsRAkr1AJ9lqX/U58rahDFAP7v9dIf30ZzPSACfcU4u
4JzBcBAuqdrghmgeRnWfBds=
=E9Hd
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/