[PATCH-tip 1/3] locking/lockdep: Make remove_class_from_lock_chains() depend on CONFIG_PROVE_LOCKING

From: Waiman Long
Date: Wed Feb 12 2020 - 10:38:59 EST


The remove_class_from_lock_chains() is essentially an no-op if
CONFIG_PROVE_LOCKING isn't enabled. Make it so.

Signed-off-by: Waiman Long <longman@xxxxxxxxxx>
---
kernel/locking/lockdep.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index e55c4ee14e64..3dad36e2187b 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -4998,12 +4998,12 @@ void lockdep_reset(void)
raw_local_irq_restore(flags);
}

+#ifdef CONFIG_PROVE_LOCKING
/* Remove a class from a lock chain. Must be called with the graph lock held. */
static void remove_class_from_lock_chain(struct pending_free *pf,
struct lock_chain *chain,
struct lock_class *class)
{
-#ifdef CONFIG_PROVE_LOCKING
int i;

for (i = chain->base; i < chain->base + chain->depth; i++) {
@@ -5031,13 +5031,14 @@ static void remove_class_from_lock_chain(struct pending_free *pf,
hlist_del_rcu(&chain->entry);
__set_bit(chain - lock_chains, pf->lock_chains_being_freed);
nr_zapped_lock_chains++;
-#endif
}
+#endif

/* Must be called with the graph lock held. */
static void remove_class_from_lock_chains(struct pending_free *pf,
struct lock_class *class)
{
+#ifdef CONFIG_PROVE_LOCKING
struct lock_chain *chain;
struct hlist_head *head;
int i;
@@ -5048,6 +5049,7 @@ static void remove_class_from_lock_chains(struct pending_free *pf,
remove_class_from_lock_chain(pf, chain, class);
}
}
+#endif
}

/*
--
2.18.1