Browse Source

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
Abhishek Singh 8 years ago
parent
commit
ff2328f3a0
2 changed files with 43 additions and 2 deletions
  1. 22 1
      qdf/inc/qdf_list.h
  2. 21 1
      qdf/linux/src/qdf_list.c

+ 22 - 1
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,

+ 21 - 1
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