From ff2328f3a0a6ef610a7340fd6102b367a6a53636 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Tue, 31 Jan 2017 17:13:34 +0530 Subject: [PATCH] qcacmn: API to insert node before/after a node in qdf list Currently there is no support to insert a node in between the qdf list. This change adds API to insert a new node before/after node in qdf list. Change-Id: I91ad5d57ffb5d15abdd5faa36387198608369b12 CRs-Fixed: 1117206 --- qdf/inc/qdf_list.h | 23 ++++++++++++++++++++++- qdf/linux/src/qdf_list.c | 22 +++++++++++++++++++++- 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/qdf/inc/qdf_list.h b/qdf/inc/qdf_list.h index 509516875056..0b9f8c803c1b 100644 --- a/qdf/inc/qdf_list.h +++ b/qdf/inc/qdf_list.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -56,6 +56,27 @@ typedef __qdf_list_node_t qdf_list_node_t; typedef __qdf_list_t qdf_list_t; /* Function declarations */ + +/** + * qdf_list_insert_before() - insert new node before the node + * @list: Pointer to list + * @new_node: Pointer to input node + * @node: node before which new node should be added. + * + * Return: QDF status + */ +QDF_STATUS qdf_list_insert_before(qdf_list_t *list, + qdf_list_node_t *new_node, qdf_list_node_t *node); +/** + * qdf_list_insert_after() - insert new node after the node + * @list: Pointer to list + * @new_node: Pointer to input node + * @node: node after which new node should be added. + * + * Return: QDF status + */ +QDF_STATUS qdf_list_insert_after(qdf_list_t *list, + qdf_list_node_t *new_node, qdf_list_node_t *node); QDF_STATUS qdf_list_insert_front(qdf_list_t *list, qdf_list_node_t *node); QDF_STATUS qdf_list_insert_back_size(qdf_list_t *list, qdf_list_node_t *node, diff --git a/qdf/linux/src/qdf_list.c b/qdf/linux/src/qdf_list.c index 4d373beb1042..7d6df221ef0c 100644 --- a/qdf/linux/src/qdf_list.c +++ b/qdf/linux/src/qdf_list.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -39,6 +39,26 @@ /* Function declarations and documenation */ +QDF_STATUS qdf_list_insert_before(qdf_list_t *list, + qdf_list_node_t *new_node, qdf_list_node_t *node) +{ + list_add_tail(new_node, node); + list->count++; + + return QDF_STATUS_SUCCESS; +} +EXPORT_SYMBOL(qdf_list_insert_before); + +QDF_STATUS qdf_list_insert_after(qdf_list_t *list, + qdf_list_node_t *new_node, qdf_list_node_t *node) +{ + list_add(new_node, node); + list->count++; + + return QDF_STATUS_SUCCESS; +} +EXPORT_SYMBOL(qdf_list_insert_after); + /** * qdf_list_insert_front() - insert input node at front of the list * @list: Pointer to list