fix(ble/bluedroid): Align config, controller indent and init error paths

- bt_target: remove/align obsolete macros with Kconfig
- device/controller: fix start_up() Secure Connections indent,
  get_ble_resolving_list_max_size return type
- controller.h: align type/interface declarations with implementation
- bte_init: remove unused/redundant code
- bte_main: return -1 on osi_init failure, null check in bte_main_hci_send
This commit is contained in:
zhiweijian
2026-03-18 16:33:22 +08:00
parent 6f5d9e3440
commit b83647f5ea
5 changed files with 17 additions and 26 deletions
@@ -681,10 +681,6 @@
#define BTA_DM_QOS_INCLUDED FALSE
#endif
#ifndef BTA_PAN_INCLUDED
#define BTA_PAN_INCLUDED FALSE
#endif
#ifndef BTA_HD_INCLUDED
#define BTA_HD_INCLUDED FALSE
#endif
@@ -223,13 +223,13 @@ static void start_up(void)
}
#endif
if ((bluedroid_config_get()->get_sc_enabled())) {
controller_param.secure_connections_supported = HCI_SC_CTRLR_SUPPORTED(controller_param.features_classic[2].as_array);
if (controller_param.secure_connections_supported) {
response = AWAIT_COMMAND(controller_param.packet_factory->make_write_secure_connections_host_support(HCI_SC_MODE_ENABLED));
controller_param.packet_parser->parse_generic_command_complete(response);
if ((bluedroid_config_get()->get_sc_enabled())) {
controller_param.secure_connections_supported = HCI_SC_CTRLR_SUPPORTED(controller_param.features_classic[2].as_array);
if (controller_param.secure_connections_supported) {
response = AWAIT_COMMAND(controller_param.packet_factory->make_write_secure_connections_host_support(HCI_SC_MODE_ENABLED));
controller_param.packet_parser->parse_generic_command_complete(response);
}
}
}
#if (BLE_INCLUDED == TRUE)
#if (CLASSIC_BT_INCLUDED)
@@ -546,7 +546,7 @@ static uint8_t get_ble_resolving_list_max_size(void)
return controller_param.ble_resolving_list_max_size;
}
static void set_ble_resolving_list_max_size(int resolving_list_max_size)
static void set_ble_resolving_list_max_size(uint8_t resolving_list_max_size)
{
assert(controller_param.readable);
assert(controller_param.ble_supported);
@@ -78,7 +78,7 @@ typedef struct controller_t {
uint8_t (*get_ble_white_list_size)(void);
uint8_t (*get_ble_resolving_list_max_size)(void);
void (*set_ble_resolving_list_max_size)(int resolving_list_max_size);
void (*set_ble_resolving_list_max_size)(uint8_t resolving_list_max_size);
#if (BLE_50_FEATURE_SUPPORT == TRUE)
#if (BLE_50_EXTEND_ADV_EN == TRUE)
@@ -152,10 +152,6 @@
#include "bta_gatts_int.h"
#endif
#if BTA_PAN_INCLUDED==TRUE
#include "bta_pan_int.h"
#endif
#if BTA_PBA_CLIENT_INCLUDED == TRUE
#include "bta_pba_client_int.h"
#endif
@@ -481,9 +477,6 @@ bt_status_t BTE_InitStack(void)
}
memset((void *)bta_jv_cb_ptr, 0, sizeof(tBTA_JV_CB));
#endif //JV
#if BTA_HS_INCLUDED == TRUE
memset((void *)bta_hs_cb_ptr, 0, sizeof(tBTA_HS_CB));
#endif
#if BTA_SDP_INCLUDED == TRUE
if ((bta_sdp_cb_ptr = (tBTA_SDP_CB *)osi_malloc(sizeof(tBTA_SDP_CB))) == NULL) {
goto error_exit;
@@ -525,9 +518,6 @@ bt_status_t BTE_InitStack(void)
}
memset((void *)bta_hd_cb_ptr, 0, sizeof(tBTA_HD_CB));
#endif
#if BTA_HL_INCLUDED==TRUE
memset((void *)bta_hl_cb_ptr, 0, sizeof(tBTA_HL_CB));
#endif
#if GATTC_INCLUDED==TRUE
if ((bta_gattc_cb_ptr = (tBTA_GATTC_CB *)osi_malloc(sizeof(tBTA_GATTC_CB))) == NULL) {
goto error_exit;
@@ -540,9 +530,6 @@ bt_status_t BTE_InitStack(void)
}
memset((void *)bta_gatts_cb_ptr, 0, sizeof(tBTA_GATTS_CB));
#endif
#if BTA_PAN_INCLUDED==TRUE
memset((void *)bta_pan_cb_ptr, 0, sizeof(tBTA_PAN_CB));
#endif
#if BTA_PBA_CLIENT_INCLUDED == TRUE
if ((bta_pba_client_cb_ptr = (tBTA_PBA_CLIENT_CB *)osi_malloc(sizeof(tBTA_PBA_CLIENT_CB))) == NULL) {
goto error_exit;
+9 -1
View File
@@ -86,7 +86,10 @@ int bte_main_boot_entry(bluedroid_init_done_cb_t cb)
bluedroid_init_done_cb = cb;
osi_init();
if (osi_init() != 0) {
APPL_TRACE_ERROR("%s failed to initialize OS layer.\n", __func__);
return -1;
}
//Enable HCI
bte_main_enable();
@@ -235,6 +238,11 @@ void bte_main_lpm_wake_bt_device(void)
******************************************************************************/
void bte_main_hci_send (BT_HDR *p_msg, UINT16 event)
{
if (!p_msg) {
APPL_TRACE_ERROR("%s null message\n", __func__);
return;
}
UINT16 sub_event = event & BT_SUB_EVT_MASK; /* local controller ID */
p_msg->event = event;