components/bt: Fix warning when disable debug logs or in release mode and improve the code structure

This commit is contained in:
baohongde 2019-03-26 14:59:58 +08:00
parent 286202caa3
commit bbdb236ab7
15 changed files with 54 additions and 26 deletions

View file

@ -1268,7 +1268,7 @@ BOOLEAN bta_av_hdl_event(BT_HDR *p_msg)
** Returns char * ** Returns char *
** **
*******************************************************************************/ *******************************************************************************/
static char *bta_av_st_code(UINT8 state) UNUSED_ATTR static char *bta_av_st_code(UINT8 state)
{ {
switch (state) { switch (state) {
case BTA_AV_INIT_ST: return "INIT"; case BTA_AV_INIT_ST: return "INIT";

View file

@ -28,6 +28,7 @@
#include <string.h> #include <string.h>
#include "bta/bta_av_co.h" #include "bta/bta_av_co.h"
#include "bta_av_int.h" #include "bta_av_int.h"
#include "osi/osi.h"
/***************************************************************************** /*****************************************************************************
** Constants and types ** Constants and types
@ -564,7 +565,7 @@ void bta_av_set_scb_sst_incoming (tBTA_AV_SCB *p_scb)
** Returns char * ** Returns char *
** **
*******************************************************************************/ *******************************************************************************/
static char *bta_av_sst_code(UINT8 state) UNUSED_ATTR static char *bta_av_sst_code(UINT8 state)
{ {
switch (state) { switch (state) {
case BTA_AV_INIT_SST: return "INIT"; case BTA_AV_INIT_SST: return "INIT";

View file

@ -5777,6 +5777,8 @@ void bta_dm_proc_open_evt(tBTA_GATTC_OPEN *p_data)
((p2[0]) << 24) + ((p2[1]) << 16) + ((p2[2]) << 8) + (p2[3]), ((p2[0]) << 24) + ((p2[1]) << 16) + ((p2[2]) << 8) + (p2[3]),
((p2[4]) << 8) + p2[5]); ((p2[4]) << 8) + p2[5]);
UNUSED(p1);
UNUSED(p2);
APPL_TRACE_DEBUG("BTA_GATTC_OPEN_EVT conn_id = %d client_if=%d status = %d" , APPL_TRACE_DEBUG("BTA_GATTC_OPEN_EVT conn_id = %d client_if=%d status = %d" ,
p_data->conn_id, p_data->conn_id,
p_data->client_if, p_data->client_if,

View file

@ -1159,6 +1159,7 @@ static char *bta_hf_client_skip_unknown(char *buffer)
buffer = tmp + 2; buffer = tmp + 2;
APPL_TRACE_DEBUG("%s %.*s", __FUNCTION__, buffer - start - 2, start); APPL_TRACE_DEBUG("%s %.*s", __FUNCTION__, buffer - start - 2, start);
UNUSED(start);
return buffer; return buffer;
} }

View file

@ -308,6 +308,7 @@ static void bta_hf_client_sco_disc_cback(UINT16 sco_idx)
#if (BTM_SCO_HCI_INCLUDED == TRUE ) #if (BTM_SCO_HCI_INCLUDED == TRUE )
tBTM_STATUS status = BTM_ConfigScoPath(BTM_SCO_ROUTE_PCM, NULL, NULL, TRUE); tBTM_STATUS status = BTM_ConfigScoPath(BTM_SCO_ROUTE_PCM, NULL, NULL, TRUE);
APPL_TRACE_DEBUG("%s close config status = %d", __FUNCTION__, status); APPL_TRACE_DEBUG("%s close config status = %d", __FUNCTION__, status);
UNUSED(status);
/* SCO clean up here */ /* SCO clean up here */
bta_hf_client_sco_co_close(); bta_hf_client_sco_co_close();
#endif #endif

View file

@ -26,6 +26,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "osi/allocator.h" #include "osi/allocator.h"
#include "osi/osi.h"
#include "stack/bt_types.h" #include "stack/bt_types.h"
#include "bta/utl.h" #include "bta/utl.h"
#include "bta/bta_sys.h" #include "bta/bta_sys.h"
@ -137,7 +138,7 @@ UINT8 bta_jv_alloc_sec_id(void)
return ret; return ret;
} }
static int get_sec_id_used(void) UNUSED_ATTR static int get_sec_id_used(void)
{ {
int i; int i;
int used = 0; int used = 0;
@ -146,12 +147,13 @@ static int get_sec_id_used(void)
used++; used++;
} }
} }
if (used == BTA_JV_NUM_SERVICE_ID) if (used == BTA_JV_NUM_SERVICE_ID) {
APPL_TRACE_ERROR("get_sec_id_used, sec id exceeds the limit:%d", APPL_TRACE_ERROR("get_sec_id_used, sec id exceeds the limit:%d",
BTA_JV_NUM_SERVICE_ID); BTA_JV_NUM_SERVICE_ID);
}
return used; return used;
} }
static int get_rfc_cb_used(void) UNUSED_ATTR static int get_rfc_cb_used(void)
{ {
int i; int i;
int used = 0; int used = 0;
@ -160,9 +162,10 @@ static int get_rfc_cb_used(void)
used++; used++;
} }
} }
if (used == BTA_JV_MAX_RFC_CONN) if (used == BTA_JV_MAX_RFC_CONN) {
APPL_TRACE_ERROR("get_sec_id_used, rfc ctrl block exceeds the limit:%d", APPL_TRACE_ERROR("get_sec_id_used, rfc ctrl block exceeds the limit:%d",
BTA_JV_MAX_RFC_CONN); BTA_JV_MAX_RFC_CONN);
}
return used; return used;
} }
@ -474,19 +477,21 @@ static tBTA_JV_STATUS bta_jv_free_set_pm_profile_cb(UINT32 jv_handle)
< BTA_JV_MAX_RFC_SR_SESSION && bta_jv_cb.rfc_cb[hi].rfc_hdl[si]) { < BTA_JV_MAX_RFC_SR_SESSION && bta_jv_cb.rfc_cb[hi].rfc_hdl[si]) {
tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(bta_jv_cb.rfc_cb[hi].rfc_hdl[si]); tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(bta_jv_cb.rfc_cb[hi].rfc_hdl[si]);
if (p_pcb) { if (p_pcb) {
if (NULL == p_pcb->p_pm_cb) if (NULL == p_pcb->p_pm_cb) {
APPL_TRACE_WARNING("%s(jv_handle:" APPL_TRACE_WARNING("%s(jv_handle:"
" 0x%x):port_handle: 0x%x, p_pm_cb: %d: no link to " " 0x%x):port_handle: 0x%x, p_pm_cb: %d: no link to "
"pm_cb?", __func__, jv_handle, p_pcb->port_handle, i); "pm_cb?", __func__, jv_handle, p_pcb->port_handle, i);
}
p_cb = &p_pcb->p_pm_cb; p_cb = &p_pcb->p_pm_cb;
} }
} }
} else { } else {
if (jv_handle < BTA_JV_MAX_L2C_CONN) { if (jv_handle < BTA_JV_MAX_L2C_CONN) {
tBTA_JV_L2C_CB *p_l2c_cb = &bta_jv_cb.l2c_cb[jv_handle]; tBTA_JV_L2C_CB *p_l2c_cb = &bta_jv_cb.l2c_cb[jv_handle];
if (NULL == p_l2c_cb->p_pm_cb) if (NULL == p_l2c_cb->p_pm_cb) {
APPL_TRACE_WARNING("%s(jv_handle: " APPL_TRACE_WARNING("%s(jv_handle: "
"0x%x): p_pm_cb: %d: no link to pm_cb?", __func__, jv_handle, i); "0x%x): p_pm_cb: %d: no link to pm_cb?", __func__, jv_handle, i);
}
p_cb = &p_l2c_cb->p_pm_cb; p_cb = &p_l2c_cb->p_pm_cb;
} }
} }
@ -998,6 +1003,9 @@ static bool create_base_record(const uint32_t sdp_handle, const char *name, cons
APPL_TRACE_DEBUG("create_base_record: successfully created base service " APPL_TRACE_DEBUG("create_base_record: successfully created base service "
"record, handle: 0x%08x, scn: %d, name: %s, with_obex: %d", "record, handle: 0x%08x, scn: %d, name: %s, with_obex: %d",
sdp_handle, channel, name, with_obex); sdp_handle, channel, name, with_obex);
UNUSED(stage);
return TRUE; return TRUE;
} }
@ -1031,6 +1039,8 @@ static int add_spp_sdp(const char *name, const int channel) {
APPL_TRACE_DEBUG("add_spp_sdp: service registered successfully, " APPL_TRACE_DEBUG("add_spp_sdp: service registered successfully, "
"service_name: %s, handle 0x%08x)", name, handle); "service_name: %s, handle 0x%08x)", name, handle);
UNUSED(stage);
return handle; return handle;
} }
@ -1523,6 +1533,7 @@ static int bta_jv_port_data_co_cback(UINT16 port_handle, UINT8 *buf, UINT16 len,
tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(port_handle); tBTA_JV_PCB *p_pcb = bta_jv_rfc_port_to_pcb(port_handle);
int ret = 0; int ret = 0;
APPL_TRACE_DEBUG("%s, p_cb:%p, p_pcb:%p, len:%d, type:%d", __func__, p_cb, p_pcb, len, type); APPL_TRACE_DEBUG("%s, p_cb:%p, p_pcb:%p, len:%d, type:%d", __func__, p_cb, p_pcb, len, type);
UNUSED(p_cb);
if (p_pcb != NULL) { if (p_pcb != NULL) {
switch (type) { switch (type) {
case DATA_CO_CALLBACK_TYPE_INCOMING: case DATA_CO_CALLBACK_TYPE_INCOMING:

View file

@ -615,6 +615,7 @@ static void btc_a2dp_sink_handle_decoder_reset(tBTC_MEDIA_SINK_CFG_UPDATE *p_msg
int frames_to_process = ((freq_multiple) / (num_blocks * num_subbands)) + 1; int frames_to_process = ((freq_multiple) / (num_blocks * num_subbands)) + 1;
APPL_TRACE_EVENT(" Frames to be processed in 20 ms %d\n", frames_to_process); APPL_TRACE_EVENT(" Frames to be processed in 20 ms %d\n", frames_to_process);
UNUSED(frames_to_process);
} }
/******************************************************************************* /*******************************************************************************

View file

@ -495,10 +495,11 @@ static UINT64 time_now_us()
static void log_tstamps_us(char *comment) static void log_tstamps_us(char *comment)
{ {
static UINT64 prev_us = 0; static UINT64 prev_us = 0;
const UINT64 now_us = time_now_us(); UINT64 now_us = time_now_us();
APPL_TRACE_DEBUG("[%s] ts %08llu, diff : %08llu, queue sz %d", comment, now_us, now_us - prev_us, APPL_TRACE_DEBUG("[%s] ts %08llu, diff : %08llu, queue sz %d", comment, now_us, now_us - prev_us,
fixed_queue_length(btc_aa_src_cb.TxAaQ)); fixed_queue_length(btc_aa_src_cb.TxAaQ));
prev_us = now_us; prev_us = now_us;
UNUSED(prev_us);
} }
/* when true media task discards any tx frames */ /* when true media task discards any tx frames */

View file

@ -1199,10 +1199,13 @@ static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
BTC_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d\n", a2d_status); BTC_TRACE_ERROR("ERROR dump_codec_info A2D_ParsSbcInfo fail:%d\n", a2d_status);
} }
} }
UNUSED(que_len);
} }
#else #else
static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data) static void bte_av_media_callback(tBTA_AV_EVT event, tBTA_AV_MEDIA *p_data)
{ {
UNUSED(event);
UNUSED(p_data);
BTC_TRACE_WARNING("%s : event %u\n", __func__, event); BTC_TRACE_WARNING("%s : event %u\n", __func__, event);
} }
#endif #endif

View file

@ -335,6 +335,8 @@ static void handle_rc_passthrough_rsp ( tBTA_AV_REMOTE_RSP *p_remote_rsp)
} else { } else {
BTC_TRACE_ERROR("%s DUT does not support AVRCP controller role", __FUNCTION__); BTC_TRACE_ERROR("%s DUT does not support AVRCP controller role", __FUNCTION__);
} }
UNUSED(status);
#else #else
BTC_TRACE_ERROR("%s AVRCP controller role is not enabled", __FUNCTION__); BTC_TRACE_ERROR("%s AVRCP controller role is not enabled", __FUNCTION__);
#endif #endif

View file

@ -787,6 +787,7 @@ void btc_hf_client_cb_handler(btc_msg_t *msg)
{ {
BTC_TRACE_WARNING("%s: HF CLient open failed, but another device connected. status=%d state=%d connected device=%s", BTC_TRACE_WARNING("%s: HF CLient open failed, but another device connected. status=%d state=%d connected device=%s",
__FUNCTION__, p_data->open.status, btc_hf_client_cb.state, bdaddr_to_string(&btc_hf_client_cb.connected_bda, bdstr, sizeof(bdstr))); __FUNCTION__, p_data->open.status, btc_hf_client_cb.state, bdaddr_to_string(&btc_hf_client_cb.connected_bda, bdstr, sizeof(bdstr)));
UNUSED(bdstr);
break; break;
} }

View file

@ -345,8 +345,10 @@ UINT8 *avdt_scb_hdl_report(tAVDT_SCB *p_scb, UINT8 *p, UINT16 len)
p += 2; p += 2;
BE_STREAM_TO_UINT32(ssrc, p); BE_STREAM_TO_UINT32(ssrc, p);
UNUSED(ssrc);
UNUSED(o_p); UNUSED(o_p);
UNUSED(o_v); UNUSED(o_v);
UNUSED(o_cc);
switch (pt) { switch (pt) {
case AVDT_RTCP_PT_SR: /* the packet type - SR (Sender Report) */ case AVDT_RTCP_PT_SR: /* the packet type - SR (Sender Report) */

View file

@ -120,10 +120,11 @@ BOOLEAN avrc_is_valid_player_attrib_value(UINT8 attrib, UINT8 value)
result = TRUE; result = TRUE;
} }
if (!result) if (!result) {
AVRC_TRACE_ERROR( AVRC_TRACE_ERROR(
"avrc_is_valid_player_attrib_value() found not matching attrib(x%x)-value(x%x) pair!", "avrc_is_valid_player_attrib_value() found not matching attrib(x%x)-value(x%x) pair!",
attrib, value); attrib, value);
}
return result; return result;
} }

View file

@ -2192,10 +2192,11 @@ void gatt_end_operation(tGATT_CLCB *p_clcb, tGATT_STATUS status, void *p_data)
(*p_disc_cmpl_cb)(conn_id, disc_type, status); (*p_disc_cmpl_cb)(conn_id, disc_type, status);
} else if (p_cmpl_cb && op) { } else if (p_cmpl_cb && op) {
(*p_cmpl_cb)(conn_id, op, status, &cb_data); (*p_cmpl_cb)(conn_id, op, status, &cb_data);
} else } else {
GATT_TRACE_WARNING ("gatt_end_operation not sent out op=%d p_disc_cmpl_cb:%p p_cmpl_cb:%p", GATT_TRACE_WARNING ("gatt_end_operation not sent out op=%d p_disc_cmpl_cb:%p p_cmpl_cb:%p",
operation, p_disc_cmpl_cb, p_cmpl_cb); operation, p_disc_cmpl_cb, p_cmpl_cb);
} }
}
/******************************************************************************* /*******************************************************************************
** **

View file

@ -395,7 +395,6 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
STREAM_TO_UINT16 (rej_mtu, p); STREAM_TO_UINT16 (rej_mtu, p);
/* What to do with the MTU reject ? We have negotiated an MTU. For now */ /* What to do with the MTU reject ? We have negotiated an MTU. For now */
/* we will ignore it and let a higher protocol timeout take care of it */ /* we will ignore it and let a higher protocol timeout take care of it */
L2CAP_TRACE_WARNING ("L2CAP - MTU rej Handle: %d MTU: %d", p_lcb->handle, rej_mtu); L2CAP_TRACE_WARNING ("L2CAP - MTU rej Handle: %d MTU: %d", p_lcb->handle, rej_mtu);
} }
if (rej_reason == L2CAP_CMD_REJ_INVALID_CID) { if (rej_reason == L2CAP_CMD_REJ_INVALID_CID) {
@ -758,6 +757,7 @@ static void process_l2cap_cmd (tL2C_LCB *p_lcb, UINT8 *p, UINT16 pkt_len)
} }
} }
UNUSED(rej_mtu);
} }
#endif ///CLASSIC_BT_INCLUDED == TRUE #endif ///CLASSIC_BT_INCLUDED == TRUE