diff options
| author | Grant Likely <grant.likely@secretlab.ca> | 2010-01-28 16:38:25 -0500 |
|---|---|---|
| committer | Grant Likely <grant.likely@secretlab.ca> | 2010-01-28 16:38:25 -0500 |
| commit | 0ada0a73120c28cc432bcdbac061781465c2f48f (patch) | |
| tree | d17cadd4ea47e25d9e48e7d409a39c84268fbd27 /lib/rwsem-spinlock.c | |
| parent | 6016a363f6b56b46b24655bcfc0499b715851cf3 (diff) | |
| parent | 92dcffb916d309aa01778bf8963a6932e4014d07 (diff) | |
Merge commit 'v2.6.33-rc5' into secretlab/test-devicetree
Diffstat (limited to 'lib/rwsem-spinlock.c')
| -rw-r--r-- | lib/rwsem-spinlock.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/rwsem-spinlock.c b/lib/rwsem-spinlock.c index 9df3ca56db11..ccf95bff7984 100644 --- a/lib/rwsem-spinlock.c +++ b/lib/rwsem-spinlock.c | |||
| @@ -17,6 +17,19 @@ struct rwsem_waiter { | |||
| 17 | #define RWSEM_WAITING_FOR_WRITE 0x00000002 | 17 | #define RWSEM_WAITING_FOR_WRITE 0x00000002 |
| 18 | }; | 18 | }; |
| 19 | 19 | ||
| 20 | int rwsem_is_locked(struct rw_semaphore *sem) | ||
| 21 | { | ||
| 22 | int ret = 1; | ||
| 23 | unsigned long flags; | ||
| 24 | |||
| 25 | if (spin_trylock_irqsave(&sem->wait_lock, flags)) { | ||
| 26 | ret = (sem->activity != 0); | ||
| 27 | spin_unlock_irqrestore(&sem->wait_lock, flags); | ||
| 28 | } | ||
| 29 | return ret; | ||
| 30 | } | ||
| 31 | EXPORT_SYMBOL(rwsem_is_locked); | ||
| 32 | |||
| 20 | /* | 33 | /* |
| 21 | * initialise the semaphore | 34 | * initialise the semaphore |
| 22 | */ | 35 | */ |
| @@ -34,6 +47,7 @@ void __init_rwsem(struct rw_semaphore *sem, const char *name, | |||
| 34 | spin_lock_init(&sem->wait_lock); | 47 | spin_lock_init(&sem->wait_lock); |
| 35 | INIT_LIST_HEAD(&sem->wait_list); | 48 | INIT_LIST_HEAD(&sem->wait_list); |
| 36 | } | 49 | } |
| 50 | EXPORT_SYMBOL(__init_rwsem); | ||
| 37 | 51 | ||
| 38 | /* | 52 | /* |
| 39 | * handle the lock release when processes blocked on it that can now run | 53 | * handle the lock release when processes blocked on it that can now run |
| @@ -305,12 +319,3 @@ void __downgrade_write(struct rw_semaphore *sem) | |||
| 305 | spin_unlock_irqrestore(&sem->wait_lock, flags); | 319 | spin_unlock_irqrestore(&sem->wait_lock, flags); |
| 306 | } | 320 | } |
| 307 | 321 | ||
| 308 | EXPORT_SYMBOL(__init_rwsem); | ||
| 309 | EXPORT_SYMBOL(__down_read); | ||
| 310 | EXPORT_SYMBOL(__down_read_trylock); | ||
| 311 | EXPORT_SYMBOL(__down_write_nested); | ||
| 312 | EXPORT_SYMBOL(__down_write); | ||
| 313 | EXPORT_SYMBOL(__down_write_trylock); | ||
| 314 | EXPORT_SYMBOL(__up_read); | ||
| 315 | EXPORT_SYMBOL(__up_write); | ||
| 316 | EXPORT_SYMBOL(__downgrade_write); | ||
