spinlock_t typedef visibility and uninitialized spinlock

From: Carlos Vidal
Date: Mon Nov 01 2004 - 06:08:00 EST

I'm porting CIPE 1.6.0 kernel module to Kernel 2.6.8 and had problems
with "spin_is_locked on uninitialized spinlock".

After tracing the problem I found that the spinlock_t structure is not
visible to the module code. A 'gcc -E' yields:
typedef struct { } spinlock_t;

In spinlock.h, this declaration is inside a #ifdef
CONFIG_DEBUG_SPINLOCK block, so it becomes visible only

If I turn CONFIG_DEBUG_SPINLOCK on, the module loads nicely. Otherwise
I get a nasty error in syslog and sometimes a system crash, as if in
CIPE the struct was not allocated (what is the case if the compiler
uses the typedef as it is above).

The question is: is this a bug or a feature? ;-)

Should the declaration be out of the #ifdef CONFIG_DEBUG_SPINLOCK? Or
should I use a special compiler flag?

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/