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

Commit 5888caa1 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

Flatten btm_cont_rswitch_from_handle

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I5159b8acb80fbae95c73d71ee96b13ac77142358
parent 0ac90f1c
Loading
Loading
Loading
Loading
+8 −23
Original line number Diff line number Diff line
@@ -115,7 +115,6 @@ extern tBTM_CB btm_cb;

static void btm_acl_chk_peer_pkt_type_support(tACL_CONN* p,
                                              uint16_t* p_pkt_type);
static void btm_cont_rswitch(tACL_CONN* p);
static void btm_read_automatic_flush_timeout_timeout(void* data);
static void btm_read_failed_contact_counter_timeout(void* data);
static void btm_read_remote_ext_features(uint16_t handle, uint8_t page_number);
@@ -2168,18 +2167,13 @@ uint8_t BTM_SetTraceLevel(uint8_t new_level) {
  return (btm_cb.trace_level);
}

/*******************************************************************************
 *
 * Function         btm_cont_rswitch
 *
 * Description      This function is called to continue processing an active
 *                  role switch. It first disables encryption if enabled and
 *                  EPR is not supported
 *
 * Returns          void
 *
 ******************************************************************************/
void btm_cont_rswitch(tACL_CONN* p) {
void btm_cont_rswitch_from_handle(uint16_t hci_handle) {
  tACL_CONN* p = internal_.acl_get_connection_from_handle(hci_handle);
  if (p == nullptr) {
    LOG_WARN("Role switch received but with no active ACL");
    return;
  }

  /* Check to see if encryption needs to be turned off if pending
   change of link key or role switch */
  if (p->is_switch_role_mode_change()) {
@@ -2203,15 +2197,6 @@ void btm_cont_rswitch(tACL_CONN* p) {
  }
}

void btm_cont_rswitch_from_handle(uint16_t hci_handle) {
  tACL_CONN* p_acl = internal_.acl_get_connection_from_handle(hci_handle);
  if (p_acl == nullptr) {
    LOG_WARN("Role switch received but with no active ACL");
    return;
  }
  btm_cont_rswitch(p_acl);
}

/*******************************************************************************
 *
 * Function         btm_acl_resubmit_page