qcacmn: Add qdf_list static initializer macros
In order to use qdf_list in situations where static initialization is preferable, add a number of macros for statically initializing the qdf_list structures. Change-Id: I9a1291d495e7940b57d8519da0e3d62a0dfd2064 CRs-Fixed: 2222980
This commit is contained in:
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
|
* Copyright (c) 2014-2018 The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and/or distribute this software for
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
* any purpose with or without fee is hereby granted, provided that the
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
* above copyright notice and this permission notice appear in all
|
* above copyright notice and this permission notice appear in all
|
||||||
@@ -25,7 +24,6 @@
|
|||||||
* to the Linux Foundation.
|
* to the Linux Foundation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DOC: qdf_list.h
|
* DOC: qdf_list.h
|
||||||
* QCA driver framework (QDF) list APIs
|
* QCA driver framework (QDF) list APIs
|
||||||
@@ -99,6 +97,18 @@ static inline void qdf_list_create(__qdf_list_t *list, uint32_t max_size)
|
|||||||
__qdf_list_create(list, max_size);
|
__qdf_list_create(list, max_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define QDF_LIST_ANCHOR(list) __QDF_LIST_ANCHOR(list)
|
||||||
|
|
||||||
|
#define QDF_LIST_NODE_INIT(prev, next) __QDF_LIST_NODE_INIT(prev, next)
|
||||||
|
#define QDF_LIST_NODE_INIT_SINGLE(node) __QDF_LIST_NODE_INIT_SINGLE(node)
|
||||||
|
|
||||||
|
#define QDF_LIST_INIT(tail, head) __QDF_LIST_INIT(tail, head)
|
||||||
|
#define QDF_LIST_INIT_SINGLE(node) __QDF_LIST_INIT_SINGLE(node)
|
||||||
|
#define QDF_LIST_INIT_EMPTY(list) __QDF_LIST_INIT_EMPTY(list)
|
||||||
|
|
||||||
|
#define qdf_list_for_each(list_ptr, cursor, node_field) \
|
||||||
|
__qdf_list_for_each(list_ptr, cursor, node_field)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qdf_init_list_head() - initialize list head
|
* qdf_init_list_head() - initialize list head
|
||||||
* @list_head: pointer to list head
|
* @list_head: pointer to list head
|
||||||
|
@@ -1,9 +1,8 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
|
* Copyright (c) 2014-2016, 2018 The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
* Previously licensed under the ISC license by Qualcomm Atheros, Inc.
|
||||||
*
|
*
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and/or distribute this software for
|
* Permission to use, copy, modify, and/or distribute this software for
|
||||||
* any purpose with or without fee is hereby granted, provided that the
|
* any purpose with or without fee is hereby granted, provided that the
|
||||||
* above copyright notice and this permission notice appear in all
|
* above copyright notice and this permission notice appear in all
|
||||||
@@ -60,6 +59,26 @@ static inline void __qdf_list_create(__qdf_list_t *list, uint32_t max_size)
|
|||||||
list->max_size = max_size;
|
list->max_size = max_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define __QDF_LIST_ANCHOR(list) ((list).anchor)
|
||||||
|
|
||||||
|
#define __QDF_LIST_NODE_INIT(prev_node, next_node) \
|
||||||
|
{ .prev = &(prev_node), .next = &(next_node), }
|
||||||
|
|
||||||
|
#define __QDF_LIST_NODE_INIT_SINGLE(node) \
|
||||||
|
__QDF_LIST_NODE_INIT(node, node)
|
||||||
|
|
||||||
|
#define __QDF_LIST_INIT(tail, head) \
|
||||||
|
{ .anchor = __QDF_LIST_NODE_INIT(tail, head), }
|
||||||
|
|
||||||
|
#define __QDF_LIST_INIT_SINGLE(node) \
|
||||||
|
__QDF_LIST_INIT(node, node)
|
||||||
|
|
||||||
|
#define __QDF_LIST_INIT_EMPTY(list) \
|
||||||
|
__QDF_LIST_INIT_SINGLE(list.anchor)
|
||||||
|
|
||||||
|
#define __qdf_list_for_each(list_ptr, cursor, node_field) \
|
||||||
|
list_for_each_entry(cursor, &(list_ptr)->anchor, node_field)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __qdf_init_list_head() - initialize list head
|
* __qdf_init_list_head() - initialize list head
|
||||||
* @list_head: pointer to list head
|
* @list_head: pointer to list head
|
||||||
|
Reference in New Issue
Block a user