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

Commit 74bf2970 authored by Hansong Zhang's avatar Hansong Zhang
Browse files

L2cap: Remove l2cu_can_allocate_lcb()

Checking maximum number of L2cap LCB is not needed because when link is
established, we check and disconnect if maximum number is reached. Also
the condition could change when a classic link is established after the
check is done.

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I94b04125f4304937f1c9bc9eb21612685cb76816
parent b6f3d328
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -370,7 +370,7 @@ bool btm_ble_start_auto_conn() {
  }

  if (btm_ble_get_conn_st() != BLE_CONN_IDLE ||
      !background_connections_pending() || !l2cu_can_allocate_lcb()) {
      !background_connections_pending()) {
    return false;
  }

+0 −4
Original line number Diff line number Diff line
@@ -548,10 +548,6 @@ extern void l2c_fcrb_ack_timer_timeout(void* data);
extern uint8_t l2c_data_write(uint16_t cid, BT_HDR* p_data, uint16_t flag);
extern void l2c_process_held_packets(bool timed_out);

/* Functions provided by l2c_utils.cc
 ***********************************
*/
extern bool l2cu_can_allocate_lcb(void);
extern tL2C_LCB* l2cu_allocate_lcb(const RawAddress& p_bd_addr, bool is_bonding,
                                   tBT_TRANSPORT transport);
extern bool l2cu_start_post_bond_timer(uint16_t handle);
+0 −16
Original line number Diff line number Diff line
@@ -40,22 +40,6 @@
#include "l2cdefs.h"
#include "osi/include/allocator.h"

/*******************************************************************************
 *
 * Function         l2cu_can_allocate_lcb
 *
 * Description      Look for an unused LCB
 *
 * Returns          true if there is space for one more lcb
 *
 ******************************************************************************/
bool l2cu_can_allocate_lcb(void) {
  for (int i = 0; i < MAX_L2CAP_LINKS; i++) {
    if (!l2cb.lcb_pool[i].in_use) return true;
  }
  return false;
}

/*******************************************************************************
 *
 * Function         l2cu_allocate_lcb