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

Commit 8f177084 authored by Pomai Ahlo's avatar Pomai Ahlo
Browse files

Remove scn[] from java control block

We currently keep track of scn usage in both BTM and BTA.  Remove the
scn array from bta to prepare for the btm counterpart to move to bta.

Bug: 299158235
Test: m Bluetooth
Change-Id: Ic209c62da9137dfe103565017fa49eab158a12d4
parent da198344
Loading
Loading
Loading
Loading
+9 −19
Original line number Diff line number Diff line
@@ -718,21 +718,16 @@ void bta_jv_get_channel_id(
    case BTA_JV_CONN_TYPE_RFCOMM: {
      uint8_t scn = 0;
      if (channel > 0) {
        if (!BTM_TryAllocateSCN(channel)) {
          LOG(ERROR) << "rfc channel=" << channel
                     << " already in use or invalid";
          channel = 0;
        }
        if (BTM_TryAllocateSCN(channel)) {
          scn = static_cast<uint8_t>(channel);
        } else {
        channel = BTM_AllocateSCN();
        if (channel == 0) {
          LOG(ERROR) << "run out of rfc channels";
          channel = 0;
          LOG_ERROR("rfc channel %u already in use or invalid", channel);
        }
      } else {
        scn = BTM_AllocateSCN();
        if (scn == 0) {
          LOG_ERROR("out of rfc channels");
        }
      if (channel != 0) {
        bta_jv_cb.scn[channel - 1] = true;
        scn = (uint8_t)channel;
      }
      if (bta_jv_cb.p_dm_cback) {
        tBTA_JV bta_jv;
@@ -769,14 +764,9 @@ void bta_jv_get_channel_id(
void bta_jv_free_scn(int32_t type /* One of BTA_JV_CONN_TYPE_ */,
                     uint16_t scn) {
  switch (type) {
    case BTA_JV_CONN_TYPE_RFCOMM: {
      if (scn > 0 && scn <= RFCOMM_MAX_SCN && bta_jv_cb.scn[scn - 1]) {
        /* this scn is used by JV */
        bta_jv_cb.scn[scn - 1] = false;
    case BTA_JV_CONN_TYPE_RFCOMM:
      BTM_FreeSCN(scn);
      }
      break;
    }
    case BTA_JV_CONN_TYPE_L2CAP:
      bta_jv_set_free_psm(scn);
      break;
+0 −1
Original line number Diff line number Diff line
@@ -120,7 +120,6 @@ typedef struct {
  tBTA_JV_PCB port_cb[MAX_RFC_PORTS];          /* index of this array is
                                                  the port_handle, */
  uint8_t sec_id[BTA_JV_NUM_SERVICE_ID];       /* service ID */
  bool scn[RFCOMM_MAX_SCN];                    /* SCN allocated by java */
  uint16_t free_psm_list[BTA_JV_MAX_L2C_CONN]; /* PSMs freed by java
                                                (can be reused) */
  uint8_t sdp_active;                          /* see BTA_JV_SDP_ACT_* */