OSDN Git Service

Moved the OSI alarm_shutdown() operations to alarm_cleanup()
authorPavlin Radoslavov <pavlin@google.com>
Mon, 1 Jun 2015 23:08:18 +0000 (16:08 -0700)
committerPavlin Radoslavov <pavlin@google.com>
Mon, 1 Jun 2015 23:31:19 +0000 (16:31 -0700)
Also, removed the OSI module's start_up and shut_down steps,
because now they are no-op.

Bug: 21558791
Change-Id: I24259b327f399af57c37937111158baa9704f644

btcore/src/osi_module.c
btif/src/stack_manager.c
osi/include/alarm.h
osi/src/alarm.c
osi/test/AlarmTestHarness.cpp

index a9fff61..9ba9685 100644 (file)
 #include "osi/include/log.h"
 #include "osi/include/osi.h"
 
-future_t *osi_start_up(void) {
-  return NULL;
-}
-
-future_t *osi_shut_down(void) {
-  alarm_shutdown();
-  return NULL;
-}
-
 future_t *osi_clean_up(void) {
   alarm_cleanup();
   return NULL;
@@ -42,8 +33,8 @@ future_t *osi_clean_up(void) {
 const module_t osi_module = {
   .name = OSI_MODULE,
   .init = NULL,
-  .start_up = osi_start_up,
-  .shut_down = osi_shut_down,
+  .start_up = NULL,
+  .shut_down = NULL,
   .clean_up = osi_clean_up,
   .dependencies = {NULL}
 };
index 2fa8fc3..817e46f 100644 (file)
@@ -126,7 +126,6 @@ static void event_start_up_stack(UNUSED_ATTR void *context) {
   LOG_DEBUG("%s is bringing up the stack.", __func__);
   hack_future = future_new();
 
-  module_start_up(get_module(OSI_MODULE));
   // Include this for now to put btif config into a shutdown-able state
   module_start_up(get_module(BTIF_CONFIG_MODULE));
   bte_main_enable();
@@ -158,7 +157,6 @@ static void event_shut_down_stack(UNUSED_ATTR void *context) {
 
   future_await(hack_future);
   module_shut_down(get_module(CONTROLLER_MODULE)); // Doesn't do any work, just puts it in a restartable state
-  module_shut_down(get_module(OSI_MODULE));
 
   LOG_DEBUG("%s finished.", __func__);
   btif_thread_post(event_signal_stack_down, NULL);
@@ -186,10 +184,10 @@ static void event_clean_up_stack(UNUSED_ATTR void *context) {
 
   btif_shutdown_bluetooth();
   module_clean_up(get_module(BTIF_CONFIG_MODULE));
-  module_clean_up(get_module(OSI_MODULE));
   module_clean_up(get_module(BT_UTILS_MODULE));
 
   future_await(hack_future);
+  module_clean_up(get_module(OSI_MODULE));
   module_management_stop();
   LOG_DEBUG("%s finished.", __func__);
 }
index 470c482..74a7302 100644 (file)
@@ -52,9 +52,5 @@ void alarm_set_periodic(alarm_t *alarm, period_ms_t period, alarm_callback_t cb,
 // |alarm| may not be NULL.
 void alarm_cancel(alarm_t *alarm);
 
-// Shuts down the alarm dispatch callback. To be called during module/stack
-// shutdown only.
-void alarm_shutdown(void);
-
 // Alarm-related state cleanup
 void alarm_cleanup(void);
index 1ec090f..a9cd4dd 100644 (file)
@@ -177,7 +177,7 @@ void alarm_cancel(alarm_t *alarm) {
   pthread_mutex_unlock(&alarm->callback_lock);
 }
 
-void alarm_shutdown(void) {
+void alarm_cleanup(void) {
   // If lazy_initialize never ran there is nothing to do
   if (!alarms)
     return;
@@ -190,13 +190,6 @@ void alarm_shutdown(void) {
   semaphore_free(alarm_expired);
   alarm_expired = NULL;
   timer_delete(&timer);
-}
-
-void alarm_cleanup(void) {
-  // If lazy_initialize never ran there is nothing to do
-  if (!alarms)
-    return;
-
   list_free(alarms);
   alarms = NULL;
 
index 98b25af..496c70d 100644 (file)
@@ -52,7 +52,6 @@ void AlarmTestHarness::SetUp() {
 }
 
 void AlarmTestHarness::TearDown() {
-  alarm_shutdown();
   alarm_cleanup();
   timer_delete(timer);
   AllocationTestHarness::TearDown();