GKI cleanup - Replaced usage of GKI queue with OSI fixed_queue
* Added new functions to OSI:
- fixed_queue_init()
- fixed_queue_length()
- fixed_queue_try_remove_from_queue()
- fixed_queue_try_peek_last()
* Renamed fixed_queue_try_peek() to fixed_queue_try_peek_first()
* Replaced usage of GKI queue functions with OSI fixed_queue functions:
- GKI_init_q() -> fixed_queue_new(SIZE_MAX)
NOTE: unlike GKI_init_q(), fixed_queue_new() allocates memory /
state that needs to be released by calling fixed_queue_free()
- GKI_enqueue() -> fixed_queue_enqueue()
- GKI_dequeue() -> fixed_queue_try_dequeue()
NOTE: fixed_queue_try_dequeue() is non-blocking
- GKI_queue_length() -> fixed_queue_length()
- GKI_queue_is_empty() -> fixed_queue_is_empty()
- GKI_getfirst() -> fixed_queue_try_peek_first()
- GKI_getlast() -> fixed_queue_try_peek_last()
- GKI_remove_from_queue() -> fixed_queue_try_remove_from_queue()
- Queue elements iteration.
In the fixed_queue implementation we have to use the underlying
list_t mechanism to iterate over the elements.
OLD:
p = GKI_getfirst(queue);
...
while ((p = GKI_getnext(p) != NULL) {
...
}
NEW:
list_t *list = fixed_queue_get_list(queue);
for (const list_node_t *node = list_begin(list);
node != list_end(list); node = list_next(node)) {
p = list_node(node);
}
* Remove initialization of the GKI module, because it is not needed
anymore
* Removed unused files in GKI:
gki/common/gki_common.h
gki/ulinux/gki_int.h
gki/ulinux/gki_ulinux.c
Change-Id: I3ff9464db75252d6faf7476a9ca67c88e535c51c
diff --git a/stack/btm/btm_acl.c b/stack/btm/btm_acl.c
index c8e0e7b..5eb142a 100644
--- a/stack/btm/btm_acl.c
+++ b/stack/btm/btm_acl.c
@@ -2394,7 +2394,7 @@
BD_ADDR bda;
BTM_TRACE_DEBUG ("btm_acl_resubmit_page");
/* If there were other page request schedule can start the next one */
- if ((p_buf = (BT_HDR *)GKI_dequeue (&btm_cb.page_queue)) != NULL)
+ if ((p_buf = (BT_HDR *)fixed_queue_try_dequeue(btm_cb.page_queue)) != NULL)
{
/* skip 3 (2 bytes opcode and 1 byte len) to get to the bd_addr
* for both create_conn and rmt_name */
@@ -2425,8 +2425,8 @@
BT_HDR *p;
BTM_TRACE_DEBUG ("btm_acl_reset_paging");
/* If we sent reset we are definitely not paging any more */
- while ((p = (BT_HDR *)GKI_dequeue(&btm_cb.page_queue)) != NULL)
- GKI_freebuf (p);
+ while ((p = (BT_HDR *)fixed_queue_try_dequeue(btm_cb.page_queue)) != NULL)
+ GKI_freebuf(p);
btm_cb.paging = FALSE;
}
@@ -2448,7 +2448,7 @@
if (btm_cb.discing)
{
btm_cb.paging = TRUE;
- GKI_enqueue (&btm_cb.page_queue, p);
+ fixed_queue_enqueue(btm_cb.page_queue, p);
}
else
{
@@ -2462,7 +2462,7 @@
if (btm_cb.paging &&
memcmp (bda, btm_cb.connecting_bda, BD_ADDR_LEN) != 0)
{
- GKI_enqueue (&btm_cb.page_queue, p);
+ fixed_queue_enqueue(btm_cb.page_queue, p);
}
else
{