spd/lp5: Add Hynix memory part
[coreboot.git] / src / commonlib / list.c
blobb1030c8263772254b17cba7d86f7ebe5e1f5fc50
1 /* Taken from depthcharge: src/base/list.c */
2 /* SPDX-License-Identifier: GPL-2.0-or-later */
4 #include <commonlib/list.h>
6 void list_remove(struct list_node *node)
8 if (node->prev)
9 node->prev->next = node->next;
10 if (node->next)
11 node->next->prev = node->prev;
14 void list_insert_after(struct list_node *node, struct list_node *after)
16 node->next = after->next;
17 node->prev = after;
18 after->next = node;
19 if (node->next)
20 node->next->prev = node;
23 void list_insert_before(struct list_node *node, struct list_node *before)
25 node->prev = before->prev;
26 node->next = before;
27 before->prev = node;
28 if (node->prev)
29 node->prev->next = node;
32 void list_append(struct list_node *node, struct list_node *head)
34 while (head->next)
35 head = head->next;
37 list_insert_after(node, head);