From 241e3218a72cd099bd635132f7efd354fd222a6f Mon Sep 17 00:00:00 2001 From: James Bottomley Date: Thu, 1 Jul 2010 21:46:36 +0200 Subject: [PATCH] --- yaml --- r: 202543 b: refs/heads/master c: 12e4d0cc2e0a776a526c93bb2fcb9267abc6e0b1 h: refs/heads/master i: 202541: 5b87db47505d743351dfce165d02e2e5ddd25252 202539: 1a1312eb04d72a5a1f5f88fdc9191b4daa5b36e2 202535: 12fe4536413dfdc6be8c51891bbfeeef7223c467 202527: 98d28766d006d9faed1eed6457af9e23a6a1fa6c v: v3 --- [refs] | 2 +- trunk/include/linux/plist.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index f6ca8947111a..a46dd4a0c88e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: c125e96f044427f38d106fab7bc5e4a5e6a18262 +refs/heads/master: 12e4d0cc2e0a776a526c93bb2fcb9267abc6e0b1 diff --git a/trunk/include/linux/plist.h b/trunk/include/linux/plist.h index 6898985e7b38..7254eda078e5 100644 --- a/trunk/include/linux/plist.h +++ b/trunk/include/linux/plist.h @@ -259,6 +259,23 @@ static inline int plist_node_empty(const struct plist_node *node) container_of(plist_first(head), type, member) #endif +/** + * plist_last_entry - get the struct for the last entry + * @head: the &struct plist_head pointer + * @type: the type of the struct this is embedded in + * @member: the name of the list_struct within the struct + */ +#ifdef CONFIG_DEBUG_PI_LIST +# define plist_last_entry(head, type, member) \ +({ \ + WARN_ON(plist_head_empty(head)); \ + container_of(plist_last(head), type, member); \ +}) +#else +# define plist_last_entry(head, type, member) \ + container_of(plist_last(head), type, member) +#endif + /** * plist_first - return the first node (and thus, highest priority) * @head: the &struct plist_head pointer @@ -271,4 +288,16 @@ static inline struct plist_node *plist_first(const struct plist_head *head) struct plist_node, plist.node_list); } +/** + * plist_last - return the last node (and thus, lowest priority) + * @head: the &struct plist_head pointer + * + * Assumes the plist is _not_ empty. + */ +static inline struct plist_node *plist_last(const struct plist_head *head) +{ + return list_entry(head->node_list.prev, + struct plist_node, plist.node_list); +} + #endif