Remove btc_hf_idx_by_bdaddr in both btc_hf_init and btc_hf_deinit functions

This commit is contained in:
xiongweichao 2021-05-10 11:11:02 +08:00
parent 848f931e06
commit 2644f793bd

View File

@ -300,12 +300,15 @@ bt_status_t btc_hf_execute_service(BOOLEAN b_enable)
************************************************************************************/
bt_status_t btc_hf_init(bt_bdaddr_t *bd_addr)
{
int idx = 0;
UNUSED(bd_addr);
#if HFP_DYNAMIC_MEMORY == TRUE
if ((hf_local_param = (hf_local_param_t *)osi_malloc(sizeof(hf_local_param_t) * BTC_HF_NUM_CB)) == NULL) {
return BT_STATUS_FAIL;
}
#endif
int idx = btc_hf_idx_by_bdaddr(bd_addr);
BTC_TRACE_DEBUG("%s - max_hf_clients=%d", __func__, btc_max_hf_clients);
/* Invoke the enable service API to the core to set the appropriate service_id
* Internally, the HSP_SERVICE_ID shall also be enabled if HFP is enabled (phone)
@ -331,7 +334,8 @@ bt_status_t btc_hf_init(bt_bdaddr_t *bd_addr)
void btc_hf_deinit(bt_bdaddr_t *bd_addr)
{
int idx = btc_hf_idx_by_bdaddr(bd_addr);
UNUSED(bd_addr);
BTC_TRACE_EVENT("%s", __FUNCTION__);
btc_dm_disable_service(BTA_HFP_SERVICE_ID);
#if HFP_DYNAMIC_MEMORY == TRUE
@ -340,7 +344,7 @@ void btc_hf_deinit(bt_bdaddr_t *bd_addr)
hf_local_param = NULL;
}
#else
hf_local_param[idx].btc_hf_cb.initialized = false;
hf_local_param[0].btc_hf_cb.initialized = false;
#endif
}