Commit fce85b08 authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Greg Kroah-Hartman

list: introduce list_next_entry() and list_prev_entry()

[ Upstream commit 008208c6 ]

Add two trivial helpers list_next_entry() and list_prev_entry(), they
can have a lot of users including list.h itself.  In fact the 1st one is
already defined in events/core.c and bnx2x_sp.c, so the patch simply
moves the definition to list.h.
Signed-off-by: default avatarOleg 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: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent ced68efe
...@@ -1030,9 +1030,6 @@ static void bnx2x_set_one_vlan_mac_e1h(struct bnx2x *bp, ...@@ -1030,9 +1030,6 @@ static void bnx2x_set_one_vlan_mac_e1h(struct bnx2x *bp,
ETH_VLAN_FILTER_CLASSIFY, config); ETH_VLAN_FILTER_CLASSIFY, config);
} }
#define list_next_entry(pos, member) \
list_entry((pos)->member.next, typeof(*(pos)), member)
/** /**
* bnx2x_vlan_mac_restore - reconfigure next MAC/VLAN/VLAN-MAC element * bnx2x_vlan_mac_restore - reconfigure next MAC/VLAN/VLAN-MAC element
* *
......
...@@ -361,6 +361,22 @@ static inline void list_splice_tail_init(struct list_head *list, ...@@ -361,6 +361,22 @@ static inline void list_splice_tail_init(struct list_head *list,
#define list_first_entry(ptr, type, member) \ #define list_first_entry(ptr, type, member) \
list_entry((ptr)->next, type, member) list_entry((ptr)->next, type, member)
/**
* list_next_entry - get the next element in list
* @pos: the type * to cursor
* @member: the name of the list_struct within the struct.
*/
#define list_next_entry(pos, member) \
list_entry((pos)->member.next, typeof(*(pos)), member)
/**
* list_prev_entry - get the prev element in list
* @pos: the type * to cursor
* @member: the name of the list_struct within the struct.
*/
#define list_prev_entry(pos, member) \
list_entry((pos)->member.prev, typeof(*(pos)), member)
/** /**
* list_for_each - iterate over a list * list_for_each - iterate over a list
* @pos: the &struct list_head to use as a loop cursor. * @pos: the &struct list_head to use as a loop cursor.
......
...@@ -1973,9 +1973,6 @@ static void __perf_event_sync_stat(struct perf_event *event, ...@@ -1973,9 +1973,6 @@ static void __perf_event_sync_stat(struct perf_event *event,
perf_event_update_userpage(next_event); perf_event_update_userpage(next_event);
} }
#define list_next_entry(pos, member) \
list_entry(pos->member.next, typeof(*pos), member)
static void perf_event_sync_stat(struct perf_event_context *ctx, static void perf_event_sync_stat(struct perf_event_context *ctx,
struct perf_event_context *next_ctx) struct perf_event_context *next_ctx)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment