From: David Herrmann Date: Fri, 9 Jan 2015 18:05:42 +0000 (+0100) Subject: connection: provide kdbus_conn_assert_active() wrapper X-Git-Tag: upstream/0.20150129.081441utc~52 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f6f1753b217796b3b677682d57870543e8ebf5e6;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git 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 --- 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);