lockdep_assert_held is better at checking for locking requirements
since it doesn't get confused if someone else is holding the mutex.

Inspired by changes in network drivers by Lance Roy.

Signed-off-by: Stephen Hemminger <sthem...@microsoft.com>
---
 drivers/hv/channel_mgmt.c | 2 +-
 drivers/hv/connection.c   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c
index 6277597d3d58..abdaf8ac0002 100644
--- a/drivers/hv/channel_mgmt.c
+++ b/drivers/hv/channel_mgmt.c
@@ -385,7 +385,7 @@ void hv_process_channel_removal(struct vmbus_channel 
*channel)
        struct vmbus_channel *primary_channel;
        unsigned long flags;
 
-       BUG_ON(!mutex_is_locked(&vmbus_connection.channel_mutex));
+       lockdep_assert_held(&vmbus_connection.channel_mutex);
        BUG_ON(!channel->rescind);
 
        if (channel->target_cpu != get_cpu()) {
diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c
index f4d08c8ac7f8..0adaec0db85a 100644
--- a/drivers/hv/connection.c
+++ b/drivers/hv/connection.c
@@ -307,7 +307,7 @@ struct vmbus_channel *relid2channel(u32 relid)
        struct list_head *cur, *tmp;
        struct vmbus_channel *cur_sc;
 
-       BUG_ON(!mutex_is_locked(&vmbus_connection.channel_mutex));
+       lockdep_assert_held(&vmbus_connection.channel_mutex);
 
        list_for_each_entry(channel, &vmbus_connection.chn_list, listentry) {
                if (channel->offermsg.child_relid == relid) {
-- 
2.19.2

_______________________________________________
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

Reply via email to