Skip to content

Commit

Permalink
lib/Kconfig.debug: add list_sort debugging switch
Browse files Browse the repository at this point in the history
While hunting a non-existing bug in 'list_sort()', I've improved the
'list_sort_test()' function which tests the 'list_sort()' library call.
Although at the end I found a bug in my code, but not in 'list_sort()', I
think my clean-ups and improvements are worth merging because they make
the test function better.

This patch:

Make the self-tests selectable via Kconfig rather than by manual enabling
of DEBUG_LIST_SORT.

Signed-off-by: Artem Bityutskiy <[email protected]>
Cc: Don Mullis <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Artem Bityutskiy authored and torvalds committed Oct 26, 2010
1 parent e2852ae commit 6d411e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 9 additions & 0 deletions lib/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,15 @@ config DEBUG_LIST

If unsure, say N.

config TEST_LIST_SORT
bool "Linked list sorting test"
depends on DEBUG_KERNEL
help
Enable this to turn on 'list_sort()' function test. This test is
executed only once during system boot, so affects only boot time.

If unsure, say N.

config DEBUG_SG
bool "Debug SG table operations"
depends on DEBUG_KERNEL
Expand Down
4 changes: 2 additions & 2 deletions lib/list_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void list_sort(void *priv, struct list_head *head,
}
EXPORT_SYMBOL(list_sort);

#ifdef DEBUG_LIST_SORT
#ifdef CONFIG_TEST_LIST_SORT
struct debug_el {
struct list_head l_h;
int value;
Expand Down Expand Up @@ -214,4 +214,4 @@ static int __init list_sort_test(void)
return 0;
}
module_init(list_sort_test);
#endif
#endif /* CONFIG_TEST_LIST_SORT */

0 comments on commit 6d411e6

Please sign in to comment.