aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Nesterov <oleg@redhat.com>2013-11-12 18:10:02 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-11-12 22:09:23 -0500
commit8120e2e5141a420edee725ff28f18aa264795f7a (patch)
treea78ce230e01bcea6895eca8492d79fce8eb3c1a3
parent008208c6b26f21c2648c250a09c55e737c02c5f8 (diff)
list: change list_for_each_entry*() to use list_*_entry()
Now that we have list_{next,prev}_entry() we can change list_for_each_entry*() and list_safe_reset_next() to use the new helpers to improve the readability. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Cc: Eilon Greenstein <eilong@broadcom.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--include/linux/list.h44
1 files changed, 22 insertions, 22 deletions
diff --git a/include/linux/list.h b/include/linux/list.h
index 2ece63847001..c88a591d1c02 100644
--- a/include/linux/list.h
+++ b/include/linux/list.h
@@ -433,8 +433,8 @@ static inline void list_splice_tail_init(struct list_head *list,
433 */ 433 */
434#define list_for_each_entry(pos, head, member) \ 434#define list_for_each_entry(pos, head, member) \
435 for (pos = list_entry((head)->next, typeof(*pos), member); \ 435 for (pos = list_entry((head)->next, typeof(*pos), member); \
436 &pos->member != (head); \ 436 &pos->member != (head); \
437 pos = list_entry(pos->member.next, typeof(*pos), member)) 437 pos = list_next_entry(pos, member))
438 438
439/** 439/**
440 * list_for_each_entry_reverse - iterate backwards over list of given type. 440 * list_for_each_entry_reverse - iterate backwards over list of given type.
@@ -444,8 +444,8 @@ static inline void list_splice_tail_init(struct list_head *list,
444 */ 444 */
445#define list_for_each_entry_reverse(pos, head, member) \ 445#define list_for_each_entry_reverse(pos, head, member) \
446 for (pos = list_entry((head)->prev, typeof(*pos), member); \ 446 for (pos = list_entry((head)->prev, typeof(*pos), member); \
447 &pos->member != (head); \ 447 &pos->member != (head); \
448 pos = list_entry(pos->member.prev, typeof(*pos), member)) 448 pos = list_prev_entry(pos, member))
449 449
450/** 450/**
451 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue() 451 * list_prepare_entry - prepare a pos entry for use in list_for_each_entry_continue()
@@ -468,9 +468,9 @@ static inline void list_splice_tail_init(struct list_head *list,
468 * the current position. 468 * the current position.
469 */ 469 */
470#define list_for_each_entry_continue(pos, head, member) \ 470#define list_for_each_entry_continue(pos, head, member) \
471 for (pos = list_entry(pos->member.next, typeof(*pos), member); \ 471 for (pos = list_next_entry(pos, member); \
472 &pos->member != (head); \ 472 &pos->member != (head); \
473 pos = list_entry(pos->member.next, typeof(*pos), member)) 473 pos = list_next_entry(pos, member))
474 474
475/** 475/**
476 * list_for_each_entry_continue_reverse - iterate backwards from the given point 476 * list_for_each_entry_continue_reverse - iterate backwards from the given point
@@ -482,9 +482,9 @@ static inline void list_splice_tail_init(struct list_head *list,
482 * the current position. 482 * the current position.
483 */ 483 */
484#define list_for_each_entry_continue_reverse(pos, head, member) \ 484#define list_for_each_entry_continue_reverse(pos, head, member) \
485 for (pos = list_entry(pos->member.prev, typeof(*pos), member); \ 485 for (pos = list_prev_entry(pos, member); \
486 &pos->member != (head); \ 486 &pos->member != (head); \
487 pos = list_entry(pos->member.prev, typeof(*pos), member)) 487 pos = list_prev_entry(pos, member))
488 488
489/** 489/**
490 * list_for_each_entry_from - iterate over list of given type from the current point 490 * list_for_each_entry_from - iterate over list of given type from the current point
@@ -495,8 +495,8 @@ static inline void list_splice_tail_init(struct list_head *list,
495 * Iterate over list of given type, continuing from current position. 495 * Iterate over list of given type, continuing from current position.
496 */ 496 */
497#define list_for_each_entry_from(pos, head, member) \ 497#define list_for_each_entry_from(pos, head, member) \
498 for (; &pos->member != (head); \ 498 for (; &pos->member != (head); \
499 pos = list_entry(pos->member.next, typeof(*pos), member)) 499 pos = list_next_entry(pos, member))
500 500
501/** 501/**
502 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry 502 * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry
@@ -507,9 +507,9 @@ static inline void list_splice_tail_init(struct list_head *list,
507 */ 507 */
508#define list_for_each_entry_safe(pos, n, head, member) \ 508#define list_for_each_entry_safe(pos, n, head, member) \
509 for (pos = list_entry((head)->next, typeof(*pos), member), \ 509 for (pos = list_entry((head)->next, typeof(*pos), member), \
510 n = list_entry(pos->member.next, typeof(*pos), member); \ 510 n = list_next_entry(pos, member); \
511 &pos->member != (head); \ 511 &pos->member != (head); \
512 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 512 pos = n, n = list_next_entry(n, member))
513 513
514/** 514/**
515 * list_for_each_entry_safe_continue - continue list iteration safe against removal 515 * list_for_each_entry_safe_continue - continue list iteration safe against removal
@@ -522,10 +522,10 @@ static inline void list_splice_tail_init(struct list_head *list,
522 * safe against removal of list entry. 522 * safe against removal of list entry.
523 */ 523 */
524#define list_for_each_entry_safe_continue(pos, n, head, member) \ 524#define list_for_each_entry_safe_continue(pos, n, head, member) \
525 for (pos = list_entry(pos->member.next, typeof(*pos), member), \ 525 for (pos = list_next_entry(pos, member), \
526 n = list_entry(pos->member.next, typeof(*pos), member); \ 526 n = list_next_entry(pos, member); \
527 &pos->member != (head); \ 527 &pos->member != (head); \
528 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 528 pos = n, n = list_next_entry(n, member))
529 529
530/** 530/**
531 * list_for_each_entry_safe_from - iterate over list from current point safe against removal 531 * list_for_each_entry_safe_from - iterate over list from current point safe against removal
@@ -538,9 +538,9 @@ static inline void list_splice_tail_init(struct list_head *list,
538 * removal of list entry. 538 * removal of list entry.
539 */ 539 */
540#define list_for_each_entry_safe_from(pos, n, head, member) \ 540#define list_for_each_entry_safe_from(pos, n, head, member) \
541 for (n = list_entry(pos->member.next, typeof(*pos), member); \ 541 for (n = list_next_entry(pos, member); \
542 &pos->member != (head); \ 542 &pos->member != (head); \
543 pos = n, n = list_entry(n->member.next, typeof(*n), member)) 543 pos = n, n = list_next_entry(n, member))
544 544
545/** 545/**
546 * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal 546 * list_for_each_entry_safe_reverse - iterate backwards over list safe against removal
@@ -554,9 +554,9 @@ static inline void list_splice_tail_init(struct list_head *list,
554 */ 554 */
555#define list_for_each_entry_safe_reverse(pos, n, head, member) \ 555#define list_for_each_entry_safe_reverse(pos, n, head, member) \
556 for (pos = list_entry((head)->prev, typeof(*pos), member), \ 556 for (pos = list_entry((head)->prev, typeof(*pos), member), \
557 n = list_entry(pos->member.prev, typeof(*pos), member); \ 557 n = list_prev_entry(pos, member); \
558 &pos->member != (head); \ 558 &pos->member != (head); \
559 pos = n, n = list_entry(n->member.prev, typeof(*n), member)) 559 pos = n, n = list_prev_entry(n, member))
560 560
561/** 561/**
562 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop 562 * list_safe_reset_next - reset a stale list_for_each_entry_safe loop
@@ -571,7 +571,7 @@ static inline void list_splice_tail_init(struct list_head *list,
571 * completing the current iteration of the loop body. 571 * completing the current iteration of the loop body.
572 */ 572 */
573#define list_safe_reset_next(pos, n, member) \ 573#define list_safe_reset_next(pos, n, member) \
574 n = list_entry(pos->member.next, typeof(*pos), member) 574 n = list_next_entry(pos, member)
575 575
576/* 576/*
577 * Double linked lists with a single pointer list head. 577 * Double linked lists with a single pointer list head.