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

Commit 23a6f8a0 authored by Chris Manton's avatar Chris Manton
Browse files

Declare and define tACL_CONN variables together

For future clean up

Working towards encapsulation of tACL_CONN

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I459e99c4d3e05f8e33df4b29819a7da8858a31d7
parent e7335f1a
Loading
Loading
Loading
Loading
+6 −7
Original line number Diff line number Diff line
@@ -724,7 +724,6 @@ void btm_pm_proc_cmd_status(uint8_t status) {
 ******************************************************************************/
void btm_pm_proc_mode_change(uint8_t hci_status, uint16_t hci_handle,
                             uint8_t mode, uint16_t interval) {
  tACL_CONN* p;
  tBTM_PM_MCB* p_cb = NULL;
  int xx, yy, zz;
  tBTM_PM_STATE old_state;
@@ -733,7 +732,7 @@ void btm_pm_proc_mode_change(uint8_t hci_status, uint16_t hci_handle,
  xx = btm_handle_to_acl_index(hci_handle);
  if (xx >= MAX_L2CAP_LINKS) return;

  p = &btm_cb.acl_cb_.acl_db[xx];
  tACL_CONN* p_acl = &btm_cb.acl_cb_.acl_db[xx];

  /* update control block */
  p_cb = &(btm_cb.pm_mode_db[xx]);
@@ -745,7 +744,7 @@ void btm_pm_proc_mode_change(uint8_t hci_status, uint16_t hci_handle,
                  mode_to_string(old_state), mode_to_string(p_cb->state));

  if ((p_cb->state == BTM_PM_ST_ACTIVE) || (p_cb->state == BTM_PM_ST_SNIFF)) {
    l2c_OnHciModeChangeSendPendingPackets(p->remote_addr);
    l2c_OnHciModeChangeSendPendingPackets(p_acl->remote_addr);
  }

  /* notify registered parties */
@@ -777,14 +776,15 @@ void btm_pm_proc_mode_change(uint8_t hci_status, uint16_t hci_handle,
  /* notify registered parties */
  for (yy = 0; yy < BTM_MAX_PM_RECORDS; yy++) {
    if (btm_cb.pm_reg_db[yy].mask & BTM_PM_REG_NOTIF) {
      (*btm_cb.pm_reg_db[yy].cback)(p->remote_addr, mode, interval, hci_status);
      (*btm_cb.pm_reg_db[yy].cback)(p_acl->remote_addr, mode, interval,
                                    hci_status);
    }
  }
  /*check if sco disconnect  is waiting for the mode change */
  btm_sco_disc_chk_pend_for_modechange(hci_handle);

  /* If mode change was because of an active role switch or change link key */
  btm_cont_rswitch(p, btm_find_dev(p->remote_addr), hci_status);
  btm_cont_rswitch(p_acl, btm_find_dev(p_acl->remote_addr), hci_status);
}

/*******************************************************************************
@@ -804,7 +804,6 @@ void btm_pm_proc_ssr_evt(uint8_t* p, UNUSED_ATTR uint16_t evt_len) {
  uint16_t max_rx_lat;
  int xx, yy;
  tBTM_PM_MCB* p_cb;
  tACL_CONN* p_acl = NULL;
  uint16_t use_ssr = true;

  STREAM_TO_UINT8(status, p);
@@ -818,7 +817,7 @@ void btm_pm_proc_ssr_evt(uint8_t* p, UNUSED_ATTR uint16_t evt_len) {
  STREAM_TO_UINT16(max_rx_lat, p);
  p_cb = &(btm_cb.pm_mode_db[xx]);

  p_acl = &btm_cb.acl_cb_.acl_db[xx];
  tACL_CONN* p_acl = &btm_cb.acl_cb_.acl_db[xx];
  if (p_cb->interval == max_rx_lat) {
    /* using legacy sniff */
    use_ssr = false;