topology: use list_insert() macro in tplg_elem_insert()

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
This commit is contained in:
Jaroslav Kysela 2019-12-13 21:23:52 +01:00
parent c9e9ee3c40
commit 3b9e39dab5

View file

@ -131,7 +131,7 @@ struct tplg_elem *tplg_elem_lookup(struct list_head *base, const char* id,
return NULL; return NULL;
} }
/* insert a new element into list in the ascending order of index value*/ /* insert a new element into list in the ascending order of index value */
static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list) static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list)
{ {
struct list_head *pos, *p = &(elem_p->list); struct list_head *pos, *p = &(elem_p->list);
@ -142,10 +142,8 @@ static void tplg_elem_insert(struct tplg_elem *elem_p, struct list_head *list)
if (elem_p->index < elem->index) if (elem_p->index < elem->index)
break; break;
} }
p->prev = pos->prev; /* insert item before pos */
pos->prev->next = p; list_insert(p, pos->prev, pos);
pos->prev = p;
p->next = pos;
} }
/* create a new common element and object */ /* create a new common element and object */