Loading system/btif/src/stack_manager.c +9 −6 Original line number Diff line number Diff line Loading @@ -126,13 +126,14 @@ static void event_start_up_stack(UNUSED_ATTR void *context) { ensure_stack_is_initialized(); LOG_DEBUG(LOG_TAG, "%s is bringing up the stack.", __func__); hack_future = future_new(); future_t *local_hack_future = future_new(); hack_future = local_hack_future; // Include this for now to put btif config into a shutdown-able state module_start_up(get_module(BTIF_CONFIG_MODULE)); bte_main_enable(); if (future_await(hack_future) != FUTURE_SUCCESS) { if (future_await(local_hack_future) != FUTURE_SUCCESS) { stack_is_running = true; // So stack shutdown actually happens event_shut_down_stack(NULL); return; Loading @@ -151,13 +152,14 @@ static void event_shut_down_stack(UNUSED_ATTR void *context) { } LOG_DEBUG(LOG_TAG, "%s is bringing down the stack.", __func__); hack_future = future_new(); future_t *local_hack_future = future_new(); hack_future = local_hack_future; stack_is_running = false; btif_disable_bluetooth(); module_shut_down(get_module(BTIF_CONFIG_MODULE)); future_await(hack_future); future_await(local_hack_future); module_shut_down(get_module(CONTROLLER_MODULE)); // Doesn't do any work, just puts it in a restartable state LOG_DEBUG(LOG_TAG, "%s finished.", __func__); Loading @@ -181,14 +183,15 @@ static void event_clean_up_stack(UNUSED_ATTR void *context) { ensure_stack_is_not_running(); LOG_DEBUG(LOG_TAG, "%s is cleaning up the stack.", __func__); hack_future = future_new(); future_t *local_hack_future = future_new(); hack_future = local_hack_future; stack_is_initialized = false; btif_shutdown_bluetooth(); module_clean_up(get_module(BTIF_CONFIG_MODULE)); module_clean_up(get_module(BT_UTILS_MODULE)); future_await(hack_future); future_await(local_hack_future); module_clean_up(get_module(OSI_MODULE)); module_management_stop(); LOG_DEBUG(LOG_TAG, "%s finished.", __func__); Loading system/hci/src/hci_layer.c +3 −2 Original line number Diff line number Diff line Loading @@ -274,10 +274,11 @@ static future_t *start_up(void) { power_state = BT_VND_PWR_ON; vendor->send_command(VENDOR_CHIP_POWER_CONTROL, &power_state); startup_future = future_new(); future_t *local_startup_future = future_new(); startup_future = local_startup_future; LOG_DEBUG(LOG_TAG, "%s starting async portion", __func__); thread_post(thread, event_finish_startup, NULL); return startup_future; return local_startup_future; error:; shut_down(); // returns NULL so no need to wait for it return future_new_immediate(FUTURE_FAIL); Loading Loading
system/btif/src/stack_manager.c +9 −6 Original line number Diff line number Diff line Loading @@ -126,13 +126,14 @@ static void event_start_up_stack(UNUSED_ATTR void *context) { ensure_stack_is_initialized(); LOG_DEBUG(LOG_TAG, "%s is bringing up the stack.", __func__); hack_future = future_new(); future_t *local_hack_future = future_new(); hack_future = local_hack_future; // Include this for now to put btif config into a shutdown-able state module_start_up(get_module(BTIF_CONFIG_MODULE)); bte_main_enable(); if (future_await(hack_future) != FUTURE_SUCCESS) { if (future_await(local_hack_future) != FUTURE_SUCCESS) { stack_is_running = true; // So stack shutdown actually happens event_shut_down_stack(NULL); return; Loading @@ -151,13 +152,14 @@ static void event_shut_down_stack(UNUSED_ATTR void *context) { } LOG_DEBUG(LOG_TAG, "%s is bringing down the stack.", __func__); hack_future = future_new(); future_t *local_hack_future = future_new(); hack_future = local_hack_future; stack_is_running = false; btif_disable_bluetooth(); module_shut_down(get_module(BTIF_CONFIG_MODULE)); future_await(hack_future); future_await(local_hack_future); module_shut_down(get_module(CONTROLLER_MODULE)); // Doesn't do any work, just puts it in a restartable state LOG_DEBUG(LOG_TAG, "%s finished.", __func__); Loading @@ -181,14 +183,15 @@ static void event_clean_up_stack(UNUSED_ATTR void *context) { ensure_stack_is_not_running(); LOG_DEBUG(LOG_TAG, "%s is cleaning up the stack.", __func__); hack_future = future_new(); future_t *local_hack_future = future_new(); hack_future = local_hack_future; stack_is_initialized = false; btif_shutdown_bluetooth(); module_clean_up(get_module(BTIF_CONFIG_MODULE)); module_clean_up(get_module(BT_UTILS_MODULE)); future_await(hack_future); future_await(local_hack_future); module_clean_up(get_module(OSI_MODULE)); module_management_stop(); LOG_DEBUG(LOG_TAG, "%s finished.", __func__); Loading
system/hci/src/hci_layer.c +3 −2 Original line number Diff line number Diff line Loading @@ -274,10 +274,11 @@ static future_t *start_up(void) { power_state = BT_VND_PWR_ON; vendor->send_command(VENDOR_CHIP_POWER_CONTROL, &power_state); startup_future = future_new(); future_t *local_startup_future = future_new(); startup_future = local_startup_future; LOG_DEBUG(LOG_TAG, "%s starting async portion", __func__); thread_post(thread, event_finish_startup, NULL); return startup_future; return local_startup_future; error:; shut_down(); // returns NULL so no need to wait for it return future_new_immediate(FUTURE_FAIL); Loading