Re: Build breakage ...

From: Linus Torvalds
Date: Sun Nov 26 2006 - 19:30:22 EST




On Sun, 26 Nov 2006, Russell King wrote:
> >
> > Ralf, Russell, does this work for you guys?
>
> Not at all. It creates even more problems for me, with this circular
> dependency:

Ok. I just reverted it then.

Pls verify that this is all good, and I didn't mess anything up due to the
manual conflict resolution.

Linus

---
commit b8e6ec865fd1d8838b6ce9516977b65e9f08f876
Author: Linus Torvalds <torvalds@xxxxxxxxxxxxxx>
Date: Sun Nov 26 16:27:17 2006 -0800

Revert "[PATCH] Enforce "unsigned long flags;" when spinlocking"

This reverts commit ee3ce191e8eaa4cc15c51a28b34143b36404c4f5, since it
broke on at least ARM, MIPS and PA-RISC due to complicated header file
dependencies.

Conflicts in include/linux/spinlock.h (due to the "nested" variety
fixes) fixed up by hand.

Cc: Alexey Dobriyan <adobriyan@xxxxxxxxx>
Cc: Ralf Baechle <ralf@xxxxxxxxxxxxxx>
Cc: Kyle McMartin <kyle@xxxxxxxxxxxxxxxx>
Cc: Russell King <rmk+lkml@xxxxxxxxxxxxxxxx>
Signed-off-by: Linus Torvalds <torvalds@xxxxxxxx>

diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h
index 4fe740b..412e025 100644
--- a/include/linux/irqflags.h
+++ b/include/linux/irqflags.h
@@ -11,12 +11,6 @@
#ifndef _LINUX_TRACE_IRQFLAGS_H
#define _LINUX_TRACE_IRQFLAGS_H

-#define BUILD_CHECK_IRQ_FLAGS(flags) \
- do { \
- BUILD_BUG_ON(sizeof(flags) != sizeof(unsigned long)); \
- typecheck(unsigned long, flags); \
- } while (0)
-
#ifdef CONFIG_TRACE_IRQFLAGS
extern void trace_hardirqs_on(void);
extern void trace_hardirqs_off(void);
@@ -56,15 +50,10 @@
#define local_irq_disable() \
do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0)
#define local_irq_save(flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- raw_local_irq_save(flags); \
- trace_hardirqs_off(); \
- } while (0)
+ do { raw_local_irq_save(flags); trace_hardirqs_off(); } while (0)

#define local_irq_restore(flags) \
do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
if (raw_irqs_disabled_flags(flags)) { \
raw_local_irq_restore(flags); \
trace_hardirqs_off(); \
@@ -80,16 +69,8 @@
*/
# define raw_local_irq_disable() local_irq_disable()
# define raw_local_irq_enable() local_irq_enable()
-# define raw_local_irq_save(flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- local_irq_save(flags); \
- } while (0)
-# define raw_local_irq_restore(flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- local_irq_restore(flags); \
- } while (0)
+# define raw_local_irq_save(flags) local_irq_save(flags)
+# define raw_local_irq_restore(flags) local_irq_restore(flags)
#endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */

#ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT
@@ -99,11 +80,7 @@
raw_safe_halt(); \
} while (0)

-#define local_save_flags(flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- raw_local_save_flags(flags); \
- } while (0)
+#define local_save_flags(flags) raw_local_save_flags(flags)

#define irqs_disabled() \
({ \
@@ -113,11 +90,7 @@
raw_irqs_disabled_flags(flags); \
})

-#define irqs_disabled_flags(flags) \
-({ \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- raw_irqs_disabled_flags(flags); \
-})
+#define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags)
#endif /* CONFIG_X86 */

#endif
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h
index 57f670d..8451052 100644
--- a/include/linux/spinlock.h
+++ b/include/linux/spinlock.h
@@ -52,7 +52,6 @@
#include <linux/thread_info.h>
#include <linux/kernel.h>
#include <linux/stringify.h>
-#include <linux/irqflags.h>

#include <asm/system.h>

@@ -184,52 +183,24 @@ do { \
#define read_lock(lock) _read_lock(lock)

#if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK)
-#define spin_lock_irqsave(lock, flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- flags = _spin_lock_irqsave(lock); \
- } while (0)
-#define read_lock_irqsave(lock, flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- flags = _read_lock_irqsave(lock); \
- } while (0)
-#define write_lock_irqsave(lock, flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- flags = _write_lock_irqsave(lock); \
- } while (0)
+
+#define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock)
+#define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock)
+#define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock)

#ifdef CONFIG_DEBUG_LOCK_ALLOC
-#define spin_lock_irqsave_nested(lock, flags, subclass) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- flags = _spin_lock_irqsave_nested(lock, subclass); \
- } while (0)
+#define spin_lock_irqsave_nested(lock, flags, subclass) \
+ flags = _spin_lock_irqsave_nested(lock, subclass)
#else
-#define spin_lock_irqsave_nested(lock, flags, subclass) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- flags = _spin_lock_irqsave(lock); \
- } while (0)
+#define spin_lock_irqsave_nested(lock, flags, subclass) \
+ flags = _spin_lock_irqsave(lock)
#endif

#else
-#define spin_lock_irqsave(lock, flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- _spin_lock_irqsave(lock, flags); \
- } while (0)
-#define read_lock_irqsave(lock, flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- _read_lock_irqsave(lock, flags); \
- } while (0)
-#define write_lock_irqsave(lock, flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- _write_lock_irqsave(lock, flags); \
- } while (0)
+
+#define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags)
+#define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags)
+#define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags)
#define spin_lock_irqsave_nested(lock, flags, subclass) \
spin_lock_irqsave(lock, flags)

@@ -268,24 +239,15 @@ do { \
#endif

#define spin_unlock_irqrestore(lock, flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- _spin_unlock_irqrestore(lock, flags); \
- } while (0)
+ _spin_unlock_irqrestore(lock, flags)
#define spin_unlock_bh(lock) _spin_unlock_bh(lock)

#define read_unlock_irqrestore(lock, flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- _read_unlock_irqrestore(lock, flags); \
- } while (0)
+ _read_unlock_irqrestore(lock, flags)
#define read_unlock_bh(lock) _read_unlock_bh(lock)

#define write_unlock_irqrestore(lock, flags) \
- do { \
- BUILD_CHECK_IRQ_FLAGS(flags); \
- _write_unlock_irqrestore(lock, flags); \
- } while (0)
+ _write_unlock_irqrestore(lock, flags)
#define write_unlock_bh(lock) _write_unlock_bh(lock)

#define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock))
@@ -299,7 +261,6 @@ do { \

#define spin_trylock_irqsave(lock, flags) \
({ \
- BUILD_CHECK_IRQ_FLAGS(flags); \
local_irq_save(flags); \
spin_trylock(lock) ? \
1 : ({ local_irq_restore(flags); 0; }); \
-
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/