aboutsummaryrefslogtreecommitdiff
path: root/ccan
diff options
context:
space:
mode:
authorVasant Hegde <hegdevasant@linux.vnet.ibm.com>2020-02-25 16:43:27 +0530
committerOliver O'Halloran <oohall@gmail.com>2020-02-26 20:35:27 +1100
commitcaae4d476fc4c811f92686f1079dea8bd138def5 (patch)
treee296795e4d8052cfd1e5df9f596bf274b59b571f /ccan
parentc8418ac7945db2c73c458093576881d806d7e81d (diff)
downloadskiboot-caae4d476fc4c811f92686f1079dea8bd138def5.zip
skiboot-caae4d476fc4c811f92686f1079dea8bd138def5.tar.gz
skiboot-caae4d476fc4c811f92686f1079dea8bd138def5.tar.bz2
list: Add list_add_after()
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com> Signed-off-by: Oliver O'Halloran <oohall@gmail.com>
Diffstat (limited to 'ccan')
-rw-r--r--ccan/list/list.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/ccan/list/list.h b/ccan/list/list.h
index fdeddeb..1d75dd9 100644
--- a/ccan/list/list.h
+++ b/ccan/list/list.h
@@ -184,6 +184,25 @@ static inline void list_add_before(struct list_head *h, struct list_node *n,
}
/**
+ * list_add_after - add an entry after another entry.
+ * @h: the list_head to add the node to (we use it for debug purposes, can be NULL)
+ * @n: the list_node to add to the list.
+ * @p: the list_node of the other entry
+ *
+ * The list_node does not need to be initialized; it will be overwritten.
+ */
+static inline void list_add_after(struct list_head *h, struct list_node *n,
+ struct list_node *p)
+{
+ n->next = p->next;
+ n->prev = p;
+ p->next = n;
+ n->next->prev = n;
+ if (h)
+ (void)list_debug(h);
+}
+
+/**
* list_add_tail - add an entry at the end of a linked list.
* @h: the list_head to add the node to
* @n: the list_node to add to the list.