Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9aabefc1 authored by Pavlin Radoslavov's avatar Pavlin Radoslavov
Browse files

Moved the OSI alarm_shutdown() operations to alarm_cleanup()

Also, removed the OSI module's start_up and shut_down steps,
because now they are no-op.

Bug: 21558791
Change-Id: I24259b327f399af57c37937111158baa9704f644
parent ed0731bb
Loading
Loading
Loading
Loading
+2 −11
Original line number Diff line number Diff line
@@ -25,15 +25,6 @@
#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}
};
+1 −3
Original line number Diff line number Diff line
@@ -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__);
}
+0 −4
Original line number Diff line number Diff line
@@ -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);
+1 −8
Original line number Diff line number Diff line
@@ -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;

+0 −1
Original line number Diff line number Diff line
@@ -52,7 +52,6 @@ void AlarmTestHarness::SetUp() {
}

void AlarmTestHarness::TearDown() {
  alarm_shutdown();
  alarm_cleanup();
  timer_delete(timer);
  AllocationTestHarness::TearDown();