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

Commit db1b5703 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "L2cap: Change some functions to return void"

parents f9e7ccfe bb537396
Loading
Loading
Loading
Loading
+1 −7
Original line number Original line Diff line number Diff line
@@ -2533,13 +2533,7 @@ static tBTM_STATUS btm_sec_dd_create_conn(tBTM_SEC_DEV_REC* p_dev_rec) {
  /* set up the control block to indicated dedicated bonding */
  /* set up the control block to indicated dedicated bonding */
  btm_cb.pairing_flags |= BTM_PAIR_FLAGS_DISC_WHEN_DONE;
  btm_cb.pairing_flags |= BTM_PAIR_FLAGS_DISC_WHEN_DONE;


  if (!l2cu_create_conn_br_edr(p_lcb)) {
  l2cu_create_conn_br_edr(p_lcb);
    LOG(WARNING) << "Security Manager: failed create allocate LCB "
                 << p_dev_rec->bd_addr;

    l2cu_release_lcb(p_lcb);
    return (BTM_NO_RESOURCES);
  }


  btm_acl_update_busy_level(BTM_BLI_PAGE_EVT);
  btm_acl_update_busy_level(BTM_BLI_PAGE_EVT);


+12 −10
Original line number Original line Diff line number Diff line
@@ -355,12 +355,13 @@ uint16_t L2CA_ErtmConnectReq(uint16_t psm, const RawAddress& p_bd_addr,
    /* No link. Get an LCB and start link establishment */
    /* No link. Get an LCB and start link establishment */
    p_lcb = l2cu_allocate_lcb(p_bd_addr, false, BT_TRANSPORT_BR_EDR);
    p_lcb = l2cu_allocate_lcb(p_bd_addr, false, BT_TRANSPORT_BR_EDR);
    /* currently use BR/EDR for ERTM mode l2cap connection */
    /* currently use BR/EDR for ERTM mode l2cap connection */
    if ((p_lcb == nullptr) || (!l2cu_create_conn_br_edr(p_lcb))) {
    if (p_lcb == nullptr) {
      LOG(WARNING) << __func__
      LOG(WARNING) << __func__
                   << ": connection not started for PSM=" << loghex(psm)
                   << ": connection not started for PSM=" << loghex(psm)
                   << ", p_lcb=" << p_lcb;
                   << ", p_lcb=" << p_lcb;
      return 0;
      return 0;
    }
    }
    l2cu_create_conn_br_edr(p_lcb);
  }
  }


  /* Allocate a channel control block */
  /* Allocate a channel control block */
@@ -1493,16 +1494,17 @@ bool L2CA_ConnectFixedChnl(uint16_t fixed_cid, const RawAddress& rem_bda,
    return false;
    return false;
  }
  }


  bool ret = ((transport == BT_TRANSPORT_LE)
  if (transport == BT_TRANSPORT_LE) {
                  ? l2cu_create_conn_le(p_lcb, initiating_phys)
    bool ret = l2cu_create_conn_le(p_lcb, initiating_phys);
                  : l2cu_create_conn_br_edr(p_lcb));

    if (!ret) {
    if (!ret) {
      L2CAP_TRACE_WARNING("%s() - create connection failed", __func__);
      L2CAP_TRACE_WARNING("%s() - create connection failed", __func__);
      l2cu_release_lcb(p_lcb);
      l2cu_release_lcb(p_lcb);
      return false;
    }
    }

  } else {
  return ret;
    l2cu_create_conn_br_edr(p_lcb);
  }
  return true;
}
}


/*******************************************************************************
/*******************************************************************************
+2 −2
Original line number Original line Diff line number Diff line
@@ -628,10 +628,10 @@ extern void l2cu_process_our_cfg_rsp(tL2C_CCB* p_ccb, tL2CAP_CFG_INFO* p_cfg);
extern tL2C_LCB* l2cu_find_lcb_by_state(tL2C_LINK_STATE state);
extern tL2C_LCB* l2cu_find_lcb_by_state(tL2C_LINK_STATE state);
extern bool l2cu_lcb_disconnecting(void);
extern bool l2cu_lcb_disconnecting(void);


extern bool l2cu_create_conn_br_edr(tL2C_LCB* p_lcb);
extern void l2cu_create_conn_br_edr(tL2C_LCB* p_lcb);
extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb);
extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb);
extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb, uint8_t initiating_phys);
extern bool l2cu_create_conn_le(tL2C_LCB* p_lcb, uint8_t initiating_phys);
extern bool l2cu_create_conn_after_switch(tL2C_LCB* p_lcb);
extern void l2cu_create_conn_after_switch(tL2C_LCB* p_lcb);
extern BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb,
extern BT_HDR* l2cu_get_next_buffer_to_send(tL2C_LCB* p_lcb,
                                            tL2C_TX_COMPLETE_CB_INFO* p_cbi);
                                            tL2C_TX_COMPLETE_CB_INFO* p_cbi);
extern void l2cu_resubmit_pending_sec_req(const RawAddress* p_bda);
extern void l2cu_resubmit_pending_sec_req(const RawAddress* p_bda);
+2 −2
Original line number Original line Diff line number Diff line
@@ -453,7 +453,7 @@ bool l2c_link_hci_disc_comp(uint16_t handle, uint8_t reason) {
        if (l2cu_create_conn_le(p_lcb))
        if (l2cu_create_conn_le(p_lcb))
          lcb_is_free = false; /* still using this lcb */
          lcb_is_free = false; /* still using this lcb */
      } else {
      } else {
        if (l2cu_create_conn_br_edr(p_lcb))
        l2cu_create_conn_br_edr(p_lcb);
        lcb_is_free = false; /* still using this lcb */
        lcb_is_free = false; /* still using this lcb */
      }
      }
    }
    }
+4 −6
Original line number Original line Diff line number Diff line
@@ -2107,7 +2107,7 @@ bool l2cu_create_conn_le(tL2C_LCB* p_lcb, uint8_t initiating_phys) {


/* This function initiates an acl connection to a Classic device via HCI.
/* This function initiates an acl connection to a Classic device via HCI.
 * Returns true on success, false otherwise. */
 * Returns true on success, false otherwise. */
bool l2cu_create_conn_br_edr(tL2C_LCB* p_lcb) {
void l2cu_create_conn_br_edr(tL2C_LCB* p_lcb) {
  int xx;
  int xx;
  tL2C_LCB* p_lcb_cur = &l2cb.lcb_pool[0];
  tL2C_LCB* p_lcb_cur = &l2cb.lcb_pool[0];
  bool is_sco_active;
  bool is_sco_active;
@@ -2145,7 +2145,7 @@ bool l2cu_create_conn_br_edr(tL2C_LCB* p_lcb) {
          alarm_set_on_mloop(p_lcb->l2c_lcb_timer,
          alarm_set_on_mloop(p_lcb->l2c_lcb_timer,
                             L2CAP_LINK_ROLE_SWITCH_TIMEOUT_MS,
                             L2CAP_LINK_ROLE_SWITCH_TIMEOUT_MS,
                             l2c_lcb_timer_timeout, p_lcb);
                             l2c_lcb_timer_timeout, p_lcb);
          return (true);
          return;
        }
        }
      }
      }
    }
    }
@@ -2153,7 +2153,7 @@ bool l2cu_create_conn_br_edr(tL2C_LCB* p_lcb) {


  p_lcb->link_state = LST_CONNECTING;
  p_lcb->link_state = LST_CONNECTING;


  return (l2cu_create_conn_after_switch(p_lcb));
  l2cu_create_conn_after_switch(p_lcb);
}
}


/*******************************************************************************
/*******************************************************************************
@@ -2189,7 +2189,7 @@ uint8_t l2cu_get_num_hi_priority(void) {
 *
 *
 ******************************************************************************/
 ******************************************************************************/


bool l2cu_create_conn_after_switch(tL2C_LCB* p_lcb) {
void l2cu_create_conn_after_switch(tL2C_LCB* p_lcb) {
  uint8_t allow_switch = HCI_CR_CONN_ALLOW_SWITCH;
  uint8_t allow_switch = HCI_CR_CONN_ALLOW_SWITCH;
  tBTM_INQ_INFO* p_inq_info;
  tBTM_INQ_INFO* p_inq_info;
  uint8_t page_scan_rep_mode;
  uint8_t page_scan_rep_mode;
@@ -2240,8 +2240,6 @@ bool l2cu_create_conn_after_switch(tL2C_LCB* p_lcb) {


  alarm_set_on_mloop(p_lcb->l2c_lcb_timer, L2CAP_LINK_CONNECT_TIMEOUT_MS,
  alarm_set_on_mloop(p_lcb->l2c_lcb_timer, L2CAP_LINK_CONNECT_TIMEOUT_MS,
                     l2c_lcb_timer_timeout, p_lcb);
                     l2c_lcb_timer_timeout, p_lcb);

  return (true);
}
}


/*******************************************************************************
/*******************************************************************************