xref: /wlan-dirver/qca-wifi-host-cmn/qdf/linux/src/i_qdf_list.h (revision fffcebf2e926a46534518e770b63d1ab6574e139)
1 /*
2  * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27 
28 /**
29  * DOC: i_qdf_list.h
30  * This file provides OS dependent list API's.
31  */
32 
33 #if !defined(__I_QDF_LIST_H)
34 #define __I_QDF_LIST_H
35 
36 #include <linux/list.h>
37 
38 /* Type declarations */
39 typedef struct list_head __qdf_list_node_t;
40 
41 /* Preprocessor definitions and constants */
42 
43 typedef struct qdf_list_s {
44 	__qdf_list_node_t anchor;
45 	uint32_t count;
46 	uint32_t max_size;
47 } __qdf_list_t;
48 
49 /**
50  * __qdf_list_create() - Create qdf list and initialize list head
51  * @list: object of list
52  * @max_size: max size of the list
53  *
54  * Return: none
55  */
56 static inline void __qdf_list_create(__qdf_list_t *list, uint32_t max_size)
57 {
58 	INIT_LIST_HEAD(&list->anchor);
59 	list->count = 0;
60 	list->max_size = max_size;
61 }
62 
63 /**
64  * __qdf_init_list_head() - initialize list head
65  * @list_head: pointer to list head
66  *
67  * Return: none
68  */
69 static inline void __qdf_init_list_head(__qdf_list_node_t *list_head)
70 {
71 	INIT_LIST_HEAD(list_head);
72 }
73 
74 bool qdf_list_has_node(__qdf_list_t *list, __qdf_list_node_t *node);
75 #endif
76