From 6cc2ef5f751a0fa6eb0799279de3988f465d3f9b Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Fri, 17 Sep 2021 08:49:31 +0800 Subject: [PATCH] [mpp_list]: Add list_mode and list_move_tail Change-Id: I7be6f69a073eeedef1b0d9ff7e9a47b48df8a8fa Signed-off-by: Herman Chen --- osal/inc/mpp_list.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/osal/inc/mpp_list.h b/osal/inc/mpp_list.h index 5b8e9090b..83531acc5 100644 --- a/osal/inc/mpp_list.h +++ b/osal/inc/mpp_list.h @@ -174,6 +174,18 @@ static __inline void list_del_init(struct list_head *entry) INIT_LIST_HEAD(entry); } +static __inline void list_move(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add(list, head); +} + +static __inline void list_move_tail(struct list_head *list, struct list_head *head) +{ + __list_del(list->prev, list->next); + list_add_tail(list, head); +} + static __inline int list_is_last(const struct list_head *list, const struct list_head *head) { return list->next == head;