X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=include%2Flinux%2Flist.h;h=9202703be2a43d15f371a62090ba68ae9ae525e0;hb=d0aa7a70bf03b9de9e995ab272293be1f7937822;hp=f9d71eab05eecc9a7d3891d346b86aa58d24233b;hpb=902b236c087bf021c94cc21a2b09d928c4156c2b;p=powerpc.git diff --git a/include/linux/list.h b/include/linux/list.h index f9d71eab05..9202703be2 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -425,6 +425,17 @@ static inline void list_splice_init_rcu(struct list_head *list, #define list_entry(ptr, type, member) \ container_of(ptr, type, member) +/** + * list_first_entry - get the first element from a list + * @ptr: the list head to take the element from. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_struct within the struct. + * + * Note, that list is expected to be not empty. + */ +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + /** * list_for_each - iterate over a list * @pos: the &struct list_head to use as a loop cursor.