From 75e8f4192e75ded418a7d228959c2ec99a13fa73 Mon Sep 17 00:00:00 2001 From: Sharvil Nanavati Date: Tue, 24 Jun 2014 17:02:30 -0700 Subject: [PATCH] Eliminate unused argument to dealloc. Change-Id: I9e54a9b9e8e250aa39e4fbfcbe934e7686d74cd4 --- hci/include/bt_hci_lib.h | 2 +- hci/src/hci_h4.c | 14 ++++++-------- hci/src/hci_mct.c | 14 ++++++-------- hci/src/userial.c | 7 +++---- hci/src/vendor.c | 2 +- main/bte_main.c | 10 ++-------- 6 files changed, 19 insertions(+), 30 deletions(-) diff --git a/hci/include/bt_hci_lib.h b/hci/include/bt_hci_lib.h index 468e51313..8186d5961 100644 --- a/hci/include/bt_hci_lib.h +++ b/hci/include/bt_hci_lib.h @@ -115,7 +115,7 @@ typedef void (*lpm_result_cb)(bt_hc_lpm_request_result_t result); typedef char* (*alloc_mem_cb)(int size); /* datapath buffer deallocation callback (callout) */ -typedef int (*dealloc_mem_cb)(TRANSAC transac, char *p_buf); +typedef void (*dealloc_mem_cb)(TRANSAC transac); /* transmit result callback */ typedef int (*tx_result_cb)(TRANSAC transac, char *p_buf, bt_hc_transmit_result_t result); diff --git a/hci/src/hci_h4.c b/hci/src/hci_h4.c index bc9f350e8..d29707079 100644 --- a/hci/src/hci_h4.c +++ b/hci/src/hci_h4.c @@ -217,7 +217,7 @@ void get_acl_data_length_cback(void *p_mem) if ((status = hci_h4_send_int_cmd(HCI_LE_READ_BUFFER_SIZE, p_buf, \ get_acl_data_length_cback)) == FALSE) { - bt_hc_cbacks->dealloc((TRANSAC) p_buf, (char *) (p_buf + 1)); + bt_hc_cbacks->dealloc(p_buf); bt_hc_cbacks->postload_cb(NULL, BT_HC_POSTLOAD_SUCCESS); } } @@ -228,7 +228,7 @@ void get_acl_data_length_cback(void *p_mem) if (bt_hc_cbacks) { - bt_hc_cbacks->dealloc((TRANSAC) p_buf, (char *) (p_buf + 1)); + bt_hc_cbacks->dealloc(p_buf); ALOGE("vendor lib postload completed"); bt_hc_cbacks->postload_cb(NULL, BT_HC_POSTLOAD_SUCCESS); } @@ -284,8 +284,7 @@ uint8_t internal_event_intercept(void) // Release the p_rcv_msg buffer. if (bt_hc_cbacks) { - bt_hc_cbacks->dealloc((TRANSAC) p_cb->p_rcv_msg, \ - (char *) (p_cb->p_rcv_msg + 1)); + bt_hc_cbacks->dealloc(p_cb->p_rcv_msg); } } p_cb->int_cmd_rd_idx = ((p_cb->int_cmd_rd_idx+1) & \ @@ -378,8 +377,7 @@ static HC_BT_HDR *acl_rx_frame_buffer_alloc (void) if (bt_hc_cbacks) { - bt_hc_cbacks->dealloc((TRANSAC) p_return_buf, \ - (char *) (p_return_buf + 1)); + bt_hc_cbacks->dealloc(p_return_buf); } p_return_buf = NULL; } @@ -715,7 +713,7 @@ void hci_h4_send_msg(HC_BT_HDR *p_msg) (p_msg->layer_specific == lay_spec)) { /* dealloc buffer of internal command */ - bt_hc_cbacks->dealloc((TRANSAC) p_msg, (char *) (p_msg + 1)); + bt_hc_cbacks->dealloc(p_msg); } else { @@ -1038,7 +1036,7 @@ void hci_h4_get_acl_data_length(void) if ((ret = hci_h4_send_int_cmd(HCI_READ_BUFFER_SIZE, p_buf, \ get_acl_data_length_cback)) == FALSE) { - bt_hc_cbacks->dealloc((TRANSAC) p_buf, (char *) (p_buf + 1)); + bt_hc_cbacks->dealloc(p_buf); } else return; diff --git a/hci/src/hci_mct.c b/hci/src/hci_mct.c index ad5891449..ac4543bc3 100644 --- a/hci/src/hci_mct.c +++ b/hci/src/hci_mct.c @@ -201,7 +201,7 @@ void get_acl_data_length_cback(void *p_mem) if ((status = hci_mct_send_int_cmd(HCI_LE_READ_BUFFER_SIZE, p_buf, \ get_acl_data_length_cback)) == FALSE) { - bt_hc_cbacks->dealloc((TRANSAC) p_buf, (char *) (p_buf + 1)); + bt_hc_cbacks->dealloc(p_buf); bt_hc_cbacks->postload_cb(NULL, BT_HC_POSTLOAD_SUCCESS); } } @@ -212,7 +212,7 @@ void get_acl_data_length_cback(void *p_mem) if (bt_hc_cbacks) { - bt_hc_cbacks->dealloc((TRANSAC) p_buf, (char *) (p_buf + 1)); + bt_hc_cbacks->dealloc(p_buf); ALOGE("hci lib postload completed"); bt_hc_cbacks->postload_cb(NULL, BT_HC_POSTLOAD_SUCCESS); } @@ -274,8 +274,7 @@ uint8_t internal_event_intercept(void) // Release the p_rcv_msg buffer. if (bt_hc_cbacks) { - bt_hc_cbacks->dealloc((TRANSAC) p_cb->rcv_evt.p_rcv_msg, \ - (char *) (p_cb->rcv_evt.p_rcv_msg + 1)); + bt_hc_cbacks->dealloc(p_cb->rcv_evt.p_rcv_msg); } } p_cb->int_cmd_rd_idx = ((p_cb->int_cmd_rd_idx+1) & \ @@ -374,8 +373,7 @@ static HC_BT_HDR *acl_rx_frame_buffer_alloc (void) if (bt_hc_cbacks) { - bt_hc_cbacks->dealloc((TRANSAC) p_return_buf, \ - (char *) (p_return_buf + 1)); + bt_hc_cbacks->dealloc(p_return_buf); } p_return_buf = NULL; } @@ -690,7 +688,7 @@ void hci_mct_send_msg(HC_BT_HDR *p_msg) (p_msg->layer_specific == lay_spec)) { /* dealloc buffer of internal command */ - bt_hc_cbacks->dealloc((TRANSAC) p_msg, (char *) (p_msg + 1)); + bt_hc_cbacks->dealloc(p_msg); } else { @@ -1141,7 +1139,7 @@ void hci_mct_get_acl_data_length(void) if ((ret = hci_mct_send_int_cmd(HCI_READ_BUFFER_SIZE, p_buf, \ get_acl_data_length_cback)) == FALSE) { - bt_hc_cbacks->dealloc((TRANSAC) p_buf, (char *) (p_buf + 1)); + bt_hc_cbacks->dealloc(p_buf); } else return; diff --git a/hci/src/userial.c b/hci/src/userial.c index 87e7916a5..c54285826 100644 --- a/hci/src/userial.c +++ b/hci/src/userial.c @@ -257,7 +257,7 @@ static void *userial_read_thread(void *arg) ALOGW("select_read return size <=0:%d, exiting userial_read_thread",\ rx_length); /* if we get here, we should have a buffer */ - bt_hc_cbacks->dealloc((TRANSAC) p_buf, (char *) (p_buf + 1)); + bt_hc_cbacks->dealloc(p_buf); /* negative value means exit thread */ break; } @@ -353,8 +353,7 @@ uint16_t userial_read(uint16_t msg_id, uint8_t *p_buffer, uint16_t len) if(userial_cb.p_rx_hdr->len == 0) { if (bt_hc_cbacks) - bt_hc_cbacks->dealloc((TRANSAC) userial_cb.p_rx_hdr, \ - (char *) (userial_cb.p_rx_hdr+1)); + bt_hc_cbacks->dealloc(userial_cb.p_rx_hdr); userial_cb.p_rx_hdr = NULL; } @@ -409,7 +408,7 @@ void userial_close(void) { // TODO: use list data structure and clean this up. void *buf; while ((buf = utils_dequeue(&userial_cb.rx_q)) != NULL) - bt_hc_cbacks->dealloc(buf, (char *) ((HC_BT_HDR *)buf + 1)); + bt_hc_cbacks->dealloc(buf); userial_cb.fd = -1; } diff --git a/hci/src/vendor.c b/hci/src/vendor.c index 71644cf10..2e5846cc5 100644 --- a/hci/src/vendor.c +++ b/hci/src/vendor.c @@ -144,7 +144,7 @@ static void *buffer_alloc(int size) { // |buffer_alloc|. static void buffer_free(void *buffer) { assert(bt_hc_cbacks != NULL); - bt_hc_cbacks->dealloc(buffer, (char *)buffer + sizeof(HC_BT_HDR)); + bt_hc_cbacks->dealloc(buffer); } // Called back from vendor library when it wants to send an HCI command. diff --git a/main/bte_main.c b/main/bte_main.c index 8f136596e..36f12d0fe 100644 --- a/main/bte_main.c +++ b/main/bte_main.c @@ -668,18 +668,12 @@ static char *alloc(int size) ** ** Bluedroid libbt-hci library uses 'transac' parameter to ** pass data-path buffer/packet across bt_hci_lib interface -** boundary. The 'p_buf' is not intended to be used here -** but might point to data portion of data-path buffer. -** -** Returns bt_hc_status_t +** boundary. ** ******************************************************************************/ -static int dealloc(TRANSAC transac, char *p_buf) +static void dealloc(TRANSAC transac) { - UNUSED(p_buf); - GKI_freebuf(transac); - return BT_HC_STATUS_SUCCESS; } /****************************************************************************** -- 2.11.0