Skip to content

Commit

Permalink
[PARISC] More useful readwrite lock helpers
Browse files Browse the repository at this point in the history
spinlock.c needs _can_lock helpers. Rewrite _is_locked helpers to be
_can_lock helpers.

Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
  • Loading branch information
Kyle McMartin authored and Kyle McMartin committed Mar 30, 2006
1 parent 102c8c7 commit bc8846c
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions include/asm-parisc/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,22 @@ static __inline__ int __raw_write_trylock(raw_rwlock_t *rw)
return 1;
}

static __inline__ int __raw_is_read_locked(raw_rwlock_t *rw)
/*
* read_can_lock - would read_trylock() succeed?
* @lock: the rwlock in question.
*/
static __inline__ int __raw_read_can_lock(raw_rwlock_t *rw)
{
return rw->counter > 0;
return rw->counter >= 0;
}

static __inline__ int __raw_is_write_locked(raw_rwlock_t *rw)
/*
* write_can_lock - would write_trylock() succeed?
* @lock: the rwlock in question.
*/
static __inline__ int __raw_write_can_lock(raw_rwlock_t *rw)
{
return rw->counter < 0;
return !rw->counter;
}

#endif /* __ASM_SPINLOCK_H */

0 comments on commit bc8846c

Please sign in to comment.