OSDN Git Service

Remove unused hci_cmd_cb in btu
authorZach Johnson <zachoverflow@google.com>
Fri, 26 Sep 2014 21:03:13 +0000 (14:03 -0700)
committerAndre Eisenbach <eisenbach@google.com>
Mon, 16 Mar 2015 23:51:35 +0000 (16:51 -0700)
An earlier change obviated the need for it, but I
forgot to remove it at that time.

stack/btm/btm_devctl.c
stack/btu/btu_hcif.c
stack/btu/btu_init.c
stack/btu/btu_task.c
stack/include/btu.h

index 98f02f9..890ef82 100644 (file)
@@ -332,9 +332,6 @@ static void btm_dev_reset (void)
 {
     btm_cb.devcb.state = BTM_DEV_STATE_WAIT_RESET_CMPLT;
 
-    /* flush out the command complete queue and command transmit queue */
-    btu_hcif_flush_cmd_queue();
-
     /* Start reset timer.  When timer expires we will send first command */
     /* from the setup sequence */
 
index ae162a0..8964115 100644 (file)
@@ -1824,30 +1824,6 @@ static void btu_hcif_simple_pair_complete_evt (UINT8 *p)
 {
     btm_simple_pair_complete(p);
 }
-/*******************************************************************************
-**
-** Function         btu_hcif_flush_cmd_queue
-**
-** Description      Flush the HCI command complete queue and transmit queue when
-**                  needed.
-**
-** Returns          void
-**
-*******************************************************************************/
-void btu_hcif_flush_cmd_queue(void)
-{
-    BT_HDR *p_cmd;
-
-    btu_cb.hci_cmd_cb[0].cmd_window = 0;
-    while ((p_cmd = (BT_HDR *) GKI_dequeue (&btu_cb.hci_cmd_cb[0].cmd_cmpl_q)) != NULL)
-    {
-        GKI_freebuf (p_cmd);
-    }
-    while ((p_cmd = (BT_HDR *) GKI_dequeue (&btu_cb.hci_cmd_cb[0].cmd_xmit_q)) != NULL)
-    {
-        GKI_freebuf (p_cmd);
-    }
-}
 
 /*******************************************************************************
 **
index 7b24ff4..8611de6 100644 (file)
@@ -149,12 +149,6 @@ void BTU_StartUp(void)
 #endif
     btu_cb.trace_level = HCI_INITIAL_TRACE_LEVEL;
 
-    for (int i = 0; i < BTU_MAX_LOCAL_CTRLS; ++i) {
-      GKI_init_q(&btu_cb.hci_cmd_cb[i].cmd_xmit_q);
-      GKI_init_q(&btu_cb.hci_cmd_cb[i].cmd_cmpl_q);
-      btu_cb.hci_cmd_cb[i].cmd_window = 1;
-    }
-
     btu_bta_msg_queue = fixed_queue_new(SIZE_MAX);
     if (btu_bta_msg_queue == NULL)
         goto error_exit;
@@ -209,13 +203,6 @@ void BTU_StartUp(void)
 }
 
 void BTU_ShutDown(void) {
-  for (int i = 0; i < BTU_MAX_LOCAL_CTRLS; ++i) {
-    while (!GKI_queue_is_empty(&btu_cb.hci_cmd_cb[i].cmd_xmit_q))
-      GKI_freebuf(GKI_dequeue(&btu_cb.hci_cmd_cb[i].cmd_xmit_q));
-    while (!GKI_queue_is_empty(&btu_cb.hci_cmd_cb[i].cmd_cmpl_q))
-      GKI_freebuf(GKI_dequeue(&btu_cb.hci_cmd_cb[i].cmd_cmpl_q));
-  }
-
   btu_task_shut_down(NULL);
 
   fixed_queue_free(btu_bta_msg_queue, NULL);
index fec9be3..86e9594 100644 (file)
@@ -840,14 +840,10 @@ void btu_stop_timer_oneshot(TIMER_LIST_ENT *p_tle) {
 *******************************************************************************/
 void btu_check_bt_sleep (void)
 {
-    if ((GKI_queue_is_empty(&btu_cb.hci_cmd_cb[LOCAL_BR_EDR_CONTROLLER_ID].cmd_cmpl_q)
-        && GKI_queue_is_empty(&btu_cb.hci_cmd_cb[LOCAL_BR_EDR_CONTROLLER_ID].cmd_xmit_q)))
+    // TODO(zachoverflow) take pending commands into account?
+    if (l2cb.controller_xmit_window == l2cb.num_lm_acl_bufs)
     {
-        if (l2cb.controller_xmit_window == l2cb.num_lm_acl_bufs)
-        {
-            /* enable dev to sleep  in the cmd cplt and cmd status only and num cplt packet */
-            bte_main_lpm_allow_bt_device_sleep();
-        }
+        bte_main_lpm_allow_bt_device_sleep();
     }
 }
 #endif
index 4567487..0c8f81c 100644 (file)
@@ -223,15 +223,6 @@ typedef struct
 #define NFC_CONTROLLER_ID       (1)
 #define BTU_MAX_LOCAL_CTRLS     (1 + NFC_MAX_LOCAL_CTRLS) /* only BR/EDR */
 
-/* AMP HCI control block */
-typedef struct
-{
-    BUFFER_Q         cmd_xmit_q;
-    BUFFER_Q         cmd_cmpl_q;
-    UINT16           cmd_window;
-    TIMER_LIST_ENT   cmd_cmpl_timer;        /* Command complete timer */
-} tHCI_CMD_CB;
-
 /* Define structure holding BTU variables
 */
 typedef struct
@@ -257,8 +248,6 @@ typedef struct
 
     BOOLEAN     reset_complete;             /* TRUE after first ack from device received */
     UINT8       trace_level;                /* Trace level for HCI layer */
-
-    tHCI_CMD_CB hci_cmd_cb[BTU_MAX_LOCAL_CTRLS]; /* including BR/EDR */
 } tBTU_CB;
 
 #ifdef __cplusplus
@@ -287,7 +276,6 @@ extern UINT32 btu_remaining_time (TIMER_LIST_ENT *p_tle);
 BTU_API extern UINT32 btu_remaining_time (TIMER_LIST_ENT *p_tle);
 BTU_API extern void btu_uipc_rx_cback(BT_HDR *p_msg);
 
-BTU_API extern void btu_hcif_flush_cmd_queue(void);
 /*
 ** Quick Timer
 */