diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-15 21:28:30 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-15 21:28:30 -0400 |
commit | 0586bed3e8563c2eb89bc7256e30ce633ae06cfb (patch) | |
tree | 7a59610f45f7222f25b3212c53fa28636bb4427c /arch/sparc | |
parent | b80cd62b7d4406bbe8c573fe4381dcc71a2850fd (diff) | |
parent | dbebbfbb1605f0179e7c0d900d941cc9c45de569 (diff) |
Merge branch 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-locking-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
rtmutex: tester: Remove the remaining BKL leftovers
lockdep/timers: Explain in detail the locking problems del_timer_sync() may cause
rtmutex: Simplify PI algorithm and make highest prio task get lock
rwsem: Remove redundant asmregparm annotation
rwsem: Move duplicate function prototypes to linux/rwsem.h
rwsem: Unify the duplicate rwsem_is_locked() inlines
rwsem: Move duplicate init macros and functions to linux/rwsem.h
rwsem: Move duplicate struct rwsem declaration to linux/rwsem.h
x86: Cleanup rwsem_count_t typedef
rwsem: Cleanup includes
locking: Remove deprecated lock initializers
cred: Replace deprecated spinlock initialization
kthread: Replace deprecated spinlock initialization
xtensa: Replace deprecated spinlock initialization
um: Replace deprecated spinlock initialization
sparc: Replace deprecated spinlock initialization
mips: Replace deprecated spinlock initialization
cris: Replace deprecated spinlock initialization
alpha: Replace deprecated spinlock initialization
rtmutex-tester: Remove BKL tests
Diffstat (limited to 'arch/sparc')
-rw-r--r-- | arch/sparc/include/asm/rwsem.h | 46 | ||||
-rw-r--r-- | arch/sparc/lib/atomic32.c | 2 |
2 files changed, 1 insertions, 47 deletions
diff --git a/arch/sparc/include/asm/rwsem.h b/arch/sparc/include/asm/rwsem.h index a2b4302869bc..069bf4d663a1 100644 --- a/arch/sparc/include/asm/rwsem.h +++ b/arch/sparc/include/asm/rwsem.h | |||
@@ -13,53 +13,12 @@ | |||
13 | 13 | ||
14 | #ifdef __KERNEL__ | 14 | #ifdef __KERNEL__ |
15 | 15 | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | |||
19 | struct rwsem_waiter; | ||
20 | |||
21 | struct rw_semaphore { | ||
22 | signed long count; | ||
23 | #define RWSEM_UNLOCKED_VALUE 0x00000000L | 16 | #define RWSEM_UNLOCKED_VALUE 0x00000000L |
24 | #define RWSEM_ACTIVE_BIAS 0x00000001L | 17 | #define RWSEM_ACTIVE_BIAS 0x00000001L |
25 | #define RWSEM_ACTIVE_MASK 0xffffffffL | 18 | #define RWSEM_ACTIVE_MASK 0xffffffffL |
26 | #define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1) | 19 | #define RWSEM_WAITING_BIAS (-RWSEM_ACTIVE_MASK-1) |
27 | #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS | 20 | #define RWSEM_ACTIVE_READ_BIAS RWSEM_ACTIVE_BIAS |
28 | #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) | 21 | #define RWSEM_ACTIVE_WRITE_BIAS (RWSEM_WAITING_BIAS + RWSEM_ACTIVE_BIAS) |
29 | spinlock_t wait_lock; | ||
30 | struct list_head wait_list; | ||
31 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
32 | struct lockdep_map dep_map; | ||
33 | #endif | ||
34 | }; | ||
35 | |||
36 | #ifdef CONFIG_DEBUG_LOCK_ALLOC | ||
37 | # define __RWSEM_DEP_MAP_INIT(lockname) , .dep_map = { .name = #lockname } | ||
38 | #else | ||
39 | # define __RWSEM_DEP_MAP_INIT(lockname) | ||
40 | #endif | ||
41 | |||
42 | #define __RWSEM_INITIALIZER(name) \ | ||
43 | { RWSEM_UNLOCKED_VALUE, __SPIN_LOCK_UNLOCKED((name).wait_lock), \ | ||
44 | LIST_HEAD_INIT((name).wait_list) __RWSEM_DEP_MAP_INIT(name) } | ||
45 | |||
46 | #define DECLARE_RWSEM(name) \ | ||
47 | struct rw_semaphore name = __RWSEM_INITIALIZER(name) | ||
48 | |||
49 | extern struct rw_semaphore *rwsem_down_read_failed(struct rw_semaphore *sem); | ||
50 | extern struct rw_semaphore *rwsem_down_write_failed(struct rw_semaphore *sem); | ||
51 | extern struct rw_semaphore *rwsem_wake(struct rw_semaphore *sem); | ||
52 | extern struct rw_semaphore *rwsem_downgrade_wake(struct rw_semaphore *sem); | ||
53 | |||
54 | extern void __init_rwsem(struct rw_semaphore *sem, const char *name, | ||
55 | struct lock_class_key *key); | ||
56 | |||
57 | #define init_rwsem(sem) \ | ||
58 | do { \ | ||
59 | static struct lock_class_key __key; \ | ||
60 | \ | ||
61 | __init_rwsem((sem), #sem, &__key); \ | ||
62 | } while (0) | ||
63 | 22 | ||
64 | /* | 23 | /* |
65 | * lock for reading | 24 | * lock for reading |
@@ -160,11 +119,6 @@ static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) | |||
160 | return atomic64_add_return(delta, (atomic64_t *)(&sem->count)); | 119 | return atomic64_add_return(delta, (atomic64_t *)(&sem->count)); |
161 | } | 120 | } |
162 | 121 | ||
163 | static inline int rwsem_is_locked(struct rw_semaphore *sem) | ||
164 | { | ||
165 | return (sem->count != 0); | ||
166 | } | ||
167 | |||
168 | #endif /* __KERNEL__ */ | 122 | #endif /* __KERNEL__ */ |
169 | 123 | ||
170 | #endif /* _SPARC64_RWSEM_H */ | 124 | #endif /* _SPARC64_RWSEM_H */ |
diff --git a/arch/sparc/lib/atomic32.c b/arch/sparc/lib/atomic32.c index cbddeb38ffda..d3c7a12ad879 100644 --- a/arch/sparc/lib/atomic32.c +++ b/arch/sparc/lib/atomic32.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)]) | 16 | #define ATOMIC_HASH(a) (&__atomic_hash[(((unsigned long)a)>>8) & (ATOMIC_HASH_SIZE-1)]) |
17 | 17 | ||
18 | spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = { | 18 | spinlock_t __atomic_hash[ATOMIC_HASH_SIZE] = { |
19 | [0 ... (ATOMIC_HASH_SIZE-1)] = SPIN_LOCK_UNLOCKED | 19 | [0 ... (ATOMIC_HASH_SIZE-1)] = __SPIN_LOCK_UNLOCKED(__atomic_hash) |
20 | }; | 20 | }; |
21 | 21 | ||
22 | #else /* SMP */ | 22 | #else /* SMP */ |