[Skiboot] [PATCH] core/lock: Simplify the check in lock_recursive()

Gavin Shan gwshan at linux.vnet.ibm.com
Fri Apr 24 14:54:34 AEST 2015


In lock_recursive(), the condition, used to check if the lock has
been held by current CPU, can be replaced with lock_held_by_me()
to simplify the code.

Signed-off-by: Gavin Shan <gwshan at linux.vnet.ibm.com>
---
 core/lock.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/core/lock.c b/core/lock.c
index ac6cb3b..fbf2d87 100644
--- a/core/lock.c
+++ b/core/lock.c
@@ -120,15 +120,13 @@ bool lock_recursive(struct lock *l)
 	if (bust_locks)
 		return false;
 
-	if ((l->lock_val & 1) &&
-	    (l->lock_val >> 32) == this_cpu()->pir)
+	if (lock_held_by_me(l))
 		return false;
 
 	lock(l);
 	return true;
 }
 
-
 void init_locks(void)
 {
 	bust_locks = false;
-- 
2.1.0



More information about the Skiboot mailing list