Skip to content

Commit

Permalink
lib: revise list_sort() header comment
Browse files Browse the repository at this point in the history
Clarify and correct header comment of list_sort().

Signed-off-by: Don Mullis <[email protected]>
Cc: Dave Airlie <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Dave Chinner <[email protected]>
Cc: Artem Bityutskiy <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
dmullis authored and torvalds committed Mar 6, 2010
1 parent 835cc0c commit 02b12b7
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions lib/list_sort.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,18 @@ static void merge_and_restore_back_links(void *priv,
}

/**
* list_sort - sort a list.
* @priv: private data, passed to @cmp
* list_sort - sort a list
* @priv: private data, opaque to list_sort(), passed to @cmp
* @head: the list to sort
* @cmp: the elements comparison function
*
* This function implements "merge sort" which has O(nlog(n)) complexity.
* The list is sorted in ascending order.
* This function implements "merge sort", which has O(nlog(n))
* complexity.
*
* The comparison function @cmp is supposed to return a negative value if @a is
* less than @b, and a positive value if @a is greater than @b. If @a and @b
* are equivalent, then it does not matter what this function returns.
* The comparison function @cmp must return a negative value if @a
* should sort before @b, and a positive value if @a should sort after
* @b. If @a and @b are equivalent, and their original relative
* ordering is to be preserved, @cmp must return 0.
*/
void list_sort(void *priv, struct list_head *head,
int (*cmp)(void *priv, struct list_head *a,
Expand Down

0 comments on commit 02b12b7

Please sign in to comment.