diff options
author | Linus Torvalds <torvalds@woody.osdl.org> | 2006-11-26 19:27:17 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2006-11-26 19:27:17 -0500 |
commit | b8e6ec865fd1d8838b6ce9516977b65e9f08f876 (patch) | |
tree | 9203493fc47d1ff55bee5c2a68884215257ad0bf | |
parent | 137b529e4df7b9cd6b235654a3f1a8f280e3463d (diff) |
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@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Kyle McMartin <kyle@parisc-linux.org>
Cc: Russell King <rmk+lkml@arm.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | include/linux/irqflags.h | 37 | ||||
-rw-r--r-- | include/linux/spinlock.h | 69 |
2 files changed, 20 insertions, 86 deletions
diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h index 4fe740bf4eae..412e025bc5c7 100644 --- a/include/linux/irqflags.h +++ b/include/linux/irqflags.h | |||
@@ -11,12 +11,6 @@ | |||
11 | #ifndef _LINUX_TRACE_IRQFLAGS_H | 11 | #ifndef _LINUX_TRACE_IRQFLAGS_H |
12 | #define _LINUX_TRACE_IRQFLAGS_H | 12 | #define _LINUX_TRACE_IRQFLAGS_H |
13 | 13 | ||
14 | #define BUILD_CHECK_IRQ_FLAGS(flags) \ | ||
15 | do { \ | ||
16 | BUILD_BUG_ON(sizeof(flags) != sizeof(unsigned long)); \ | ||
17 | typecheck(unsigned long, flags); \ | ||
18 | } while (0) | ||
19 | |||
20 | #ifdef CONFIG_TRACE_IRQFLAGS | 14 | #ifdef CONFIG_TRACE_IRQFLAGS |
21 | extern void trace_hardirqs_on(void); | 15 | extern void trace_hardirqs_on(void); |
22 | extern void trace_hardirqs_off(void); | 16 | extern void trace_hardirqs_off(void); |
@@ -56,15 +50,10 @@ | |||
56 | #define local_irq_disable() \ | 50 | #define local_irq_disable() \ |
57 | do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) | 51 | do { raw_local_irq_disable(); trace_hardirqs_off(); } while (0) |
58 | #define local_irq_save(flags) \ | 52 | #define local_irq_save(flags) \ |
59 | do { \ | 53 | do { raw_local_irq_save(flags); trace_hardirqs_off(); } while (0) |
60 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
61 | raw_local_irq_save(flags); \ | ||
62 | trace_hardirqs_off(); \ | ||
63 | } while (0) | ||
64 | 54 | ||
65 | #define local_irq_restore(flags) \ | 55 | #define local_irq_restore(flags) \ |
66 | do { \ | 56 | do { \ |
67 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
68 | if (raw_irqs_disabled_flags(flags)) { \ | 57 | if (raw_irqs_disabled_flags(flags)) { \ |
69 | raw_local_irq_restore(flags); \ | 58 | raw_local_irq_restore(flags); \ |
70 | trace_hardirqs_off(); \ | 59 | trace_hardirqs_off(); \ |
@@ -80,16 +69,8 @@ | |||
80 | */ | 69 | */ |
81 | # define raw_local_irq_disable() local_irq_disable() | 70 | # define raw_local_irq_disable() local_irq_disable() |
82 | # define raw_local_irq_enable() local_irq_enable() | 71 | # define raw_local_irq_enable() local_irq_enable() |
83 | # define raw_local_irq_save(flags) \ | 72 | # define raw_local_irq_save(flags) local_irq_save(flags) |
84 | do { \ | 73 | # define raw_local_irq_restore(flags) local_irq_restore(flags) |
85 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
86 | local_irq_save(flags); \ | ||
87 | } while (0) | ||
88 | # define raw_local_irq_restore(flags) \ | ||
89 | do { \ | ||
90 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
91 | local_irq_restore(flags); \ | ||
92 | } while (0) | ||
93 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ | 74 | #endif /* CONFIG_TRACE_IRQFLAGS_SUPPORT */ |
94 | 75 | ||
95 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT | 76 | #ifdef CONFIG_TRACE_IRQFLAGS_SUPPORT |
@@ -99,11 +80,7 @@ | |||
99 | raw_safe_halt(); \ | 80 | raw_safe_halt(); \ |
100 | } while (0) | 81 | } while (0) |
101 | 82 | ||
102 | #define local_save_flags(flags) \ | 83 | #define local_save_flags(flags) raw_local_save_flags(flags) |
103 | do { \ | ||
104 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
105 | raw_local_save_flags(flags); \ | ||
106 | } while (0) | ||
107 | 84 | ||
108 | #define irqs_disabled() \ | 85 | #define irqs_disabled() \ |
109 | ({ \ | 86 | ({ \ |
@@ -113,11 +90,7 @@ | |||
113 | raw_irqs_disabled_flags(flags); \ | 90 | raw_irqs_disabled_flags(flags); \ |
114 | }) | 91 | }) |
115 | 92 | ||
116 | #define irqs_disabled_flags(flags) \ | 93 | #define irqs_disabled_flags(flags) raw_irqs_disabled_flags(flags) |
117 | ({ \ | ||
118 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
119 | raw_irqs_disabled_flags(flags); \ | ||
120 | }) | ||
121 | #endif /* CONFIG_X86 */ | 94 | #endif /* CONFIG_X86 */ |
122 | 95 | ||
123 | #endif | 96 | #endif |
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 57f670d78f7c..8451052ca66f 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
@@ -52,7 +52,6 @@ | |||
52 | #include <linux/thread_info.h> | 52 | #include <linux/thread_info.h> |
53 | #include <linux/kernel.h> | 53 | #include <linux/kernel.h> |
54 | #include <linux/stringify.h> | 54 | #include <linux/stringify.h> |
55 | #include <linux/irqflags.h> | ||
56 | 55 | ||
57 | #include <asm/system.h> | 56 | #include <asm/system.h> |
58 | 57 | ||
@@ -184,52 +183,24 @@ do { \ | |||
184 | #define read_lock(lock) _read_lock(lock) | 183 | #define read_lock(lock) _read_lock(lock) |
185 | 184 | ||
186 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) | 185 | #if defined(CONFIG_SMP) || defined(CONFIG_DEBUG_SPINLOCK) |
187 | #define spin_lock_irqsave(lock, flags) \ | 186 | |
188 | do { \ | 187 | #define spin_lock_irqsave(lock, flags) flags = _spin_lock_irqsave(lock) |
189 | BUILD_CHECK_IRQ_FLAGS(flags); \ | 188 | #define read_lock_irqsave(lock, flags) flags = _read_lock_irqsave(lock) |
190 | flags = _spin_lock_irqsave(lock); \ | 189 | #define write_lock_irqsave(lock, flags) flags = _write_lock_irqsave(lock) |
191 | } while (0) | ||
192 | #define read_lock_irqsave(lock, flags) \ | ||
193 | do { \ | ||
194 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
195 | flags = _read_lock_irqsave(lock); \ | ||
196 | } while (0) | ||
197 | #define write_lock_irqsave(lock, flags) \ | ||
198 | do { \ | ||
199 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
200 | flags = _write_lock_irqsave(lock); \ | ||
201 | } while (0) | ||
202 | 190 | ||
203 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | 191 | #ifdef CONFIG_DEBUG_LOCK_ALLOC |
204 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 192 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ |
205 | do { \ | 193 | flags = _spin_lock_irqsave_nested(lock, subclass) |
206 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
207 | flags = _spin_lock_irqsave_nested(lock, subclass); \ | ||
208 | } while (0) | ||
209 | #else | 194 | #else |
210 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 195 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ |
211 | do { \ | 196 | flags = _spin_lock_irqsave(lock) |
212 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
213 | flags = _spin_lock_irqsave(lock); \ | ||
214 | } while (0) | ||
215 | #endif | 197 | #endif |
216 | 198 | ||
217 | #else | 199 | #else |
218 | #define spin_lock_irqsave(lock, flags) \ | 200 | |
219 | do { \ | 201 | #define spin_lock_irqsave(lock, flags) _spin_lock_irqsave(lock, flags) |
220 | BUILD_CHECK_IRQ_FLAGS(flags); \ | 202 | #define read_lock_irqsave(lock, flags) _read_lock_irqsave(lock, flags) |
221 | _spin_lock_irqsave(lock, flags); \ | 203 | #define write_lock_irqsave(lock, flags) _write_lock_irqsave(lock, flags) |
222 | } while (0) | ||
223 | #define read_lock_irqsave(lock, flags) \ | ||
224 | do { \ | ||
225 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
226 | _read_lock_irqsave(lock, flags); \ | ||
227 | } while (0) | ||
228 | #define write_lock_irqsave(lock, flags) \ | ||
229 | do { \ | ||
230 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
231 | _write_lock_irqsave(lock, flags); \ | ||
232 | } while (0) | ||
233 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ | 204 | #define spin_lock_irqsave_nested(lock, flags, subclass) \ |
234 | spin_lock_irqsave(lock, flags) | 205 | spin_lock_irqsave(lock, flags) |
235 | 206 | ||
@@ -268,24 +239,15 @@ do { \ | |||
268 | #endif | 239 | #endif |
269 | 240 | ||
270 | #define spin_unlock_irqrestore(lock, flags) \ | 241 | #define spin_unlock_irqrestore(lock, flags) \ |
271 | do { \ | 242 | _spin_unlock_irqrestore(lock, flags) |
272 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
273 | _spin_unlock_irqrestore(lock, flags); \ | ||
274 | } while (0) | ||
275 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) | 243 | #define spin_unlock_bh(lock) _spin_unlock_bh(lock) |
276 | 244 | ||
277 | #define read_unlock_irqrestore(lock, flags) \ | 245 | #define read_unlock_irqrestore(lock, flags) \ |
278 | do { \ | 246 | _read_unlock_irqrestore(lock, flags) |
279 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
280 | _read_unlock_irqrestore(lock, flags); \ | ||
281 | } while (0) | ||
282 | #define read_unlock_bh(lock) _read_unlock_bh(lock) | 247 | #define read_unlock_bh(lock) _read_unlock_bh(lock) |
283 | 248 | ||
284 | #define write_unlock_irqrestore(lock, flags) \ | 249 | #define write_unlock_irqrestore(lock, flags) \ |
285 | do { \ | 250 | _write_unlock_irqrestore(lock, flags) |
286 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
287 | _write_unlock_irqrestore(lock, flags); \ | ||
288 | } while (0) | ||
289 | #define write_unlock_bh(lock) _write_unlock_bh(lock) | 251 | #define write_unlock_bh(lock) _write_unlock_bh(lock) |
290 | 252 | ||
291 | #define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock)) | 253 | #define spin_trylock_bh(lock) __cond_lock(lock, _spin_trylock_bh(lock)) |
@@ -299,7 +261,6 @@ do { \ | |||
299 | 261 | ||
300 | #define spin_trylock_irqsave(lock, flags) \ | 262 | #define spin_trylock_irqsave(lock, flags) \ |
301 | ({ \ | 263 | ({ \ |
302 | BUILD_CHECK_IRQ_FLAGS(flags); \ | ||
303 | local_irq_save(flags); \ | 264 | local_irq_save(flags); \ |
304 | spin_trylock(lock) ? \ | 265 | spin_trylock(lock) ? \ |
305 | 1 : ({ local_irq_restore(flags); 0; }); \ | 266 | 1 : ({ local_irq_restore(flags); 0; }); \ |