diff --git a/qdf/inc/qdf_list.h b/qdf/inc/qdf_list.h index 0b9f8c803c..219a6c4080 100644 --- a/qdf/inc/qdf_list.h +++ b/qdf/inc/qdf_list.h @@ -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. * - * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * above copyright notice and this permission notice appear in all @@ -25,7 +24,6 @@ * to the Linux Foundation. */ - /** * DOC: qdf_list.h * 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); } +#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 * @list_head: pointer to list head diff --git a/qdf/linux/src/i_qdf_list.h b/qdf/linux/src/i_qdf_list.h index 41d23fc834..51a6a18553 100644 --- a/qdf/linux/src/i_qdf_list.h +++ b/qdf/linux/src/i_qdf_list.h @@ -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. * - * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the * 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; } +#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 * @list_head: pointer to list head