aboutsummaryrefslogtreecommitdiff
path: root/ccan
diff options
context:
space:
mode:
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-11-07 09:32:28 +1100
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2014-11-07 10:02:54 +1100
commit9e29e3f29faad28e43b6e1b69f57d83935229f44 (patch)
tree31098bc49d3c352f122c823b2b10ed82300e51d6 /ccan
parenta3f1ae0d3b09e391c54abf75d686efeb14259a59 (diff)
downloadskiboot-9e29e3f29faad28e43b6e1b69f57d83935229f44.zip
skiboot-9e29e3f29faad28e43b6e1b69f57d83935229f44.tar.gz
skiboot-9e29e3f29faad28e43b6e1b69f57d83935229f44.tar.bz2
list: Add list_add_before
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
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 dac63ad..1a73510 100644
--- a/ccan/list/list.h
+++ b/ccan/list/list.h
@@ -165,6 +165,25 @@ static inline void list_add(struct list_head *h, struct list_node *n)
}
/**
+ * list_add_before - add an entry before 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_before(struct list_head *h, struct list_node *n,
+ struct list_node *p)
+{
+ n->next = p;
+ n->prev = p->prev;
+ p->prev = n;
+ n->prev->next = 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.