These two functions are essentially duplicates, combine them. No functional change.
Signed-off-by: Yuyang Du <duyuy...@gmail.com> --- kernel/locking/lockdep.c | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 3dbb4d0..90d58cc 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -1677,29 +1677,18 @@ unsigned long lockdep_count_backward_deps(struct lock_class *class) } /* - * Prove that the dependency graph starting at <entry> can not - * lead to <target>. Print an error and return 0 if it does. + * Prove that the dependency graph starting at <root> can not + * lead to <target>. If existent, there is a circle when adding + * a <target> -> <root> dependency. + * + * Print an error and return 0 if it does exist. */ static noinline int -check_noncircular(struct lock_list *root, struct lock_class *target, +check_nonexistent(struct lock_list *root, struct lock_class *target, struct lock_list **target_entry) { int result; - debug_atomic_inc(nr_cyclic_checks); - - result = __bfs_forwards(root, target, class_equal, target_entry); - - return result; -} - -static noinline int -check_redundant(struct lock_list *root, struct lock_class *target, - struct lock_list **target_entry) -{ - int result; - - debug_atomic_inc(nr_redundant_checks); result = __bfs_forwards(root, target, class_equal, target_entry); @@ -2235,7 +2224,8 @@ static void print_deadlock_scenario(struct held_lock *nxt, */ this.class = hlock_class(next); this.parent = NULL; - ret = check_noncircular(&this, hlock_class(prev), &target_entry); + debug_atomic_inc(nr_cyclic_checks); + ret = check_nonexistent(&this, hlock_class(prev), &target_entry); if (unlikely(!ret)) { if (!trace->entries) { /* @@ -2287,7 +2277,8 @@ static void print_deadlock_scenario(struct held_lock *nxt, */ this.class = hlock_class(prev); this.parent = NULL; - ret = check_redundant(&this, hlock_class(next), &target_entry); + debug_atomic_inc(nr_redundant_checks); + ret = check_nonexistent(&this, hlock_class(next), &target_entry); if (!ret) { debug_atomic_inc(nr_redundant); return 2; -- 1.8.3.1