From 2500b02d832233d3b77ec9f8427d5aadbaadc41b Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Fri, 9 Jan 2015 00:16:04 +0100 Subject: [PATCH] connection: simplify kdbus_conn_lock2() We can use mutex_lock_nested() in both cases, so simplify the code. Signed-off-by: David Herrmann --- connection.h | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/connection.h b/connection.h index 11dbd31..413b780 100644 --- a/connection.h +++ b/connection.h @@ -221,21 +221,13 @@ static inline void kdbus_conn_lock2(struct kdbus_conn *a, struct kdbus_conn *b) if (a < b) { if (a) mutex_lock(&a->lock); - if (b) { - if (a) - mutex_lock_nested(&b->lock, 1); - else - mutex_lock(&b->lock); - } + if (b) + mutex_lock_nested(&b->lock, !!a); } else { if (b) mutex_lock(&b->lock); - if (a) { - if (b) - mutex_lock_nested(&a->lock, 1); - else - mutex_lock(&a->lock); - } + if (a) + mutex_lock_nested(&a->lock, !!b); } } -- 2.34.1