From f6f1753b217796b3b677682d57870543e8ebf5e6 Mon Sep 17 00:00:00 2001 From: David Herrmann Date: Fri, 9 Jan 2015 19:05:42 +0100 Subject: [PATCH] connection: provide kdbus_conn_assert_active() wrapper Avoid depending on lockdep internals everywhere. Use kdbus_conn_assert_active() to check whether the caller holds an active reference. Signed-off-by: David Herrmann --- connection.h | 12 ++++++++++++ match.c | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/connection.h b/connection.h index e535ab8..cde2003 100644 --- a/connection.h +++ b/connection.h @@ -247,4 +247,16 @@ static inline void kdbus_conn_unlock2(struct kdbus_conn *a, mutex_unlock(&b->lock); } +/** + * kdbus_conn_assert_active() - lockdep assert on active lock + * @conn: connection that shall be active + * + * This verifies via lockdep that the caller holds an active reference to the + * given connection. + */ +static inline void kdbus_conn_assert_active(struct kdbus_conn *conn) +{ + lockdep_assert_held(conn); +} + #endif diff --git a/match.c b/match.c index cac414e..d4f2184 100644 --- a/match.c +++ b/match.c @@ -372,7 +372,7 @@ int kdbus_match_db_add(struct kdbus_conn *conn, struct kdbus_item *item; int ret = 0; - lockdep_assert_held(conn); + kdbus_conn_assert_active(conn); entry = kzalloc(sizeof(*entry), GFP_KERNEL); if (!entry) @@ -525,7 +525,7 @@ int kdbus_match_db_remove(struct kdbus_conn *conn, struct kdbus_match_db *mdb = conn->match_db; int ret; - lockdep_assert_held(conn); + kdbus_conn_assert_active(conn); down_write(&mdb->mdb_rwlock); ret = kdbus_match_db_remove_unlocked(mdb, cmd->cookie); -- 2.34.1