Re: [PATCH] reduce code in generic spinlock.h

Dave Hansen
2002-07-23T19:39:09Z

[-- Attachment #1: Type: text/plain, Size: 419 bytes --]

Robert Love wrote:
> It will not apply to Linus's current tree, however, because of the IRQ
> rewrite that is now applied. If you pull his BK tree and diff against
> that, you should be OK... most notably, the preemption code has moved to
> preempt.h.

OK, this just made it simpler. Just remove the preempt ifdef and the
extra spinlock calls. Patch against latest BK attached.

--
Dave Hansen
haveblue@us.ibm.com

[-- Attachment #2: spinlock-cleanup-bk0723.diff --]
[-- Type: text/plain, Size: 1072 bytes --]

diff -Nru a/include/linux/spinlock.h b/include/linux/spinlock.h
--- a/include/linux/spinlock.h Tue Jul 23 13:56:42 2002
+++ b/include/linux/spinlock.h Tue Jul 23 13:56:42 2002
@@ -119,8 +119,6 @@

#endif /* !SMP */

-#ifdef CONFIG_PREEMPT
-
#define spin_lock(lock) \
do { \
preempt_disable(); \
@@ -147,20 +145,6 @@
#define write_unlock(lock) ({_raw_write_unlock(lock); preempt_enable();})
#define write_trylock(lock) ({preempt_disable();_raw_write_trylock(lock) ? \
1 : ({preempt_enable(); 0;});})
-
-#else
-
-#define spin_lock(lock) _raw_spin_lock(lock)
-#define spin_trylock(lock) _raw_spin_trylock(lock)
-#define spin_unlock(lock) _raw_spin_unlock(lock)
-#define spin_unlock_no_resched(lock) _raw_spin_unlock(lock)
-
-#define read_lock(lock) _raw_read_lock(lock)
-#define read_unlock(lock) _raw_read_unlock(lock)
-#define write_lock(lock) _raw_write_lock(lock)
-#define write_unlock(lock) _raw_write_unlock(lock)
-#define write_trylock(lock) _raw_write_trylock(lock)
-#endif

/* "lock on reference count zero" */
#ifndef ATOMIC_DEC_AND_LOCK