aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/list.h
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2010-01-09 14:53:14 -0500
committerFrederic Weisbecker <fweisbec@gmail.com>2010-01-16 06:29:32 -0500
commit5908cdc85eb30f8d07f2cb11d4a62334d7229048 (patch)
tree6d63ec247a47b957bea52578e77c8d6bda942eb0 /include/linux/list.h
parent889ff0150661512d79484219612b7e2e024b6c07 (diff)
list: Introduce list_rotate_left()
Bring a new list_rotate_left() helper that rotates a list to the left. This is useful for codes that need to round roubin elements which queue priority increases from tail to head. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Acked-by: Peter Zijlstra <peterz@infradead.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
Diffstat (limited to 'include/linux/list.h')
-rw-r--r--include/linux/list.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index 969f6e92d089..5d9c6558e8ab 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -206,6 +206,20 @@ static inline int list_empty_careful(const struct list_head *head)
206} 206}
207 207
208/** 208/**
209 * list_rotate_left - rotate the list to the left
210 * @head: the head of the list
211 */
212static inline void list_rotate_left(struct list_head *head)
213{
214 struct list_head *first;
215
216 if (!list_empty(head)) {
217 first = head->next;
218 list_move_tail(first, head);
219 }
220}
221
222/**
209 * list_is_singular - tests whether a list has just one entry. 223 * list_is_singular - tests whether a list has just one entry.
210 * @head: the list to test. 224 * @head: the list to test.
211 */ 225 */