Skip to content

Commit

Permalink
[ARM] 5067/1: _raw_write_can_lock macro bugfix
Browse files Browse the repository at this point in the history
The current __raw_write_can_lock macro tests whether the lock can be
locked by checking if it is equal to 0x80000000, whereas the lock
should be lockable if its value is 0 i.e. unlocked state is
represented by 0. Hence the macro should test the value of lock
against 0 and not 0x80000000.

Signed-off-by: Surinder Pal Singh <srplsnh@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
  • Loading branch information
surinder authored and Russell King committed Jun 2, 2008
1 parent ea6a740 commit 1e5c594
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/asm-arm/spinlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ static inline void __raw_write_unlock(raw_rwlock_t *rw)
}

/* write_can_lock - would write_trylock() succeed? */
#define __raw_write_can_lock(x) ((x)->lock == 0x80000000)
#define __raw_write_can_lock(x) ((x)->lock == 0)

/*
* Read locks are a bit more hairy:
Expand Down

0 comments on commit 1e5c594

Please sign in to comment.