lib/percpu_counter: tame kernel-doc compile warning
[linux-2.6-microblaze.git] / lib / list_sort.c
index 52f0c25..1e1e377 100644 (file)
@@ -7,16 +7,13 @@
 #include <linux/list_sort.h>
 #include <linux/list.h>
 
-typedef int __attribute__((nonnull(2,3))) (*cmp_func)(void *,
-               struct list_head const *, struct list_head const *);
-
 /*
  * Returns a list organized in an intermediate format suited
  * to chaining of merge() calls: null-terminated, no reserved or
  * sentinel head node, "prev" links not maintained.
  */
 __attribute__((nonnull(2,3,4)))
-static struct list_head *merge(void *priv, cmp_func cmp,
+static struct list_head *merge(void *priv, list_cmp_func_t cmp,
                                struct list_head *a, struct list_head *b)
 {
        struct list_head *head, **tail = &head;
@@ -52,7 +49,7 @@ static struct list_head *merge(void *priv, cmp_func cmp,
  * throughout.
  */
 __attribute__((nonnull(2,3,4,5)))
-static void merge_final(void *priv, cmp_func cmp, struct list_head *head,
+static void merge_final(void *priv, list_cmp_func_t cmp, struct list_head *head,
                        struct list_head *a, struct list_head *b)
 {
        struct list_head *tail = head;
@@ -140,7 +137,7 @@ static void merge_final(void *priv, cmp_func cmp, struct list_head *head,
  *
  *
  * The merging is controlled by "count", the number of elements in the
- * pending lists.  This is beautiully simple code, but rather subtle.
+ * pending lists.  This is beautifully simple code, but rather subtle.
  *
  * Each time we increment "count", we set one bit (bit k) and clear
  * bits k-1 .. 0.  Each time this happens (except the very first time
@@ -185,9 +182,7 @@ static void merge_final(void *priv, cmp_func cmp, struct list_head *head,
  * 2^(k+1) - 1 (second merge of case 5 when x == 2^(k-1) - 1).
  */
 __attribute__((nonnull(2,3)))
-void list_sort(void *priv, struct list_head *head,
-               int (*cmp)(void *priv, struct list_head *a,
-                       struct list_head *b))
+void list_sort(void *priv, struct list_head *head, list_cmp_func_t cmp)
 {
        struct list_head *list = head->next, *pending = NULL;
        size_t count = 0;       /* Count of pending */
@@ -227,7 +222,7 @@ void list_sort(void *priv, struct list_head *head,
                if (likely(bits)) {
                        struct list_head *a = *tail, *b = a->prev;
 
-                       a = merge(priv, (cmp_func)cmp, b, a);
+                       a = merge(priv, cmp, b, a);
                        /* Install the merged result in place of the inputs */
                        a->prev = b->prev;
                        *tail = a;
@@ -249,10 +244,10 @@ void list_sort(void *priv, struct list_head *head,
 
                if (!next)
                        break;
-               list = merge(priv, (cmp_func)cmp, pending, list);
+               list = merge(priv, cmp, pending, list);
                pending = next;
        }
        /* The final merge, rebuilding prev links */
-       merge_final(priv, (cmp_func)cmp, head, pending, list);
+       merge_final(priv, cmp, head, pending, list);
 }
 EXPORT_SYMBOL(list_sort);