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

Commit 69a9e8a3 authored by Chris Manton's avatar Chris Manton
Browse files

stack::btm::rnr::btm_initiate_rem_name Remove invariant parameter

`origin` never changes and is left over from when GAP used
this call too

Bug: 345308037
Test: m .
Flag: EXEMPT, Mechanical Refactor
Change-Id: I734ca92d3ce16a043716c8d6e9af94b1db986ed0
parent b24b4c86
Loading
Loading
Loading
Loading
+45 −47
Original line number Diff line number Diff line
@@ -242,7 +242,7 @@ static void btm_init_inq_result_flt(void);
void btm_clr_inq_result_flt(void);
static void btm_inq_rmt_name_failed_cancelled(void);
static tBTM_STATUS btm_initiate_rem_name(const RawAddress& remote_bda,
                                         uint8_t origin, uint64_t timeout_ms,
                                         uint64_t timeout_ms,
                                         tBTM_NAME_CMPL_CB* p_cb);

static uint8_t btm_convert_uuid_to_eir_service(uint16_t uuid16);
@@ -832,8 +832,7 @@ tBTM_STATUS BTM_ReadRemoteDeviceName(const RawAddress& remote_bda,
    return btm_ble_read_remote_name(remote_bda, p_cb);
  }
  /* Use classic transport for BR/EDR and Dual Mode devices */
  return btm_initiate_rem_name(remote_bda, BTM_RMT_NAME_EXT,
                               BTM_EXT_RMT_NAME_TIMEOUT_MS, p_cb);
  return btm_initiate_rem_name(remote_bda, BTM_EXT_RMT_NAME_TIMEOUT_MS, p_cb);
}

/*******************************************************************************
@@ -1871,25 +1870,27 @@ static void btm_process_cancel_complete(tHCI_STATUS status, uint8_t mode) {
 *                  called either by GAP or by the API call
 *                  BTM_ReadRemoteDeviceName.
 *
 * Input Params:    p_cb            - callback function called when
 * Input Params:    remote_bda: Remote address to execute RNR
 *                  timeout_ms: Internal timeout to await response
 * *                p_cb:       Callback function called when
 *                              BTM_CMD_STARTED is returned.
 *                              A pointer to tBTM_REMOTE_DEV_NAME is
 *                              passed to the callback.
 *
 * Returns
 *                  BTM_CMD_STARTED is returned if the request was sent to HCI.
 *                    and the callback will be called.
 *                  BTM_BUSY if already in progress
 *                  BTM_NO_RESOURCES if could not allocate resources to start
 *                                   the command
 *                  BTM_WRONG_MODE if the device is not up.
 *
 ******************************************************************************/
tBTM_STATUS btm_initiate_rem_name(const RawAddress& remote_bda, uint8_t origin,
tBTM_STATUS btm_initiate_rem_name(const RawAddress& remote_bda,
                                  uint64_t timeout_ms,
                                  tBTM_NAME_CMPL_CB* p_cb) {
  /*** Make sure the device is ready ***/
  if (!BTM_IsDeviceUp()) return (BTM_WRONG_MODE);
  if (origin == BTM_RMT_NAME_EXT) {
  if (btm_cb.btm_inq_vars.remname_active) {
    return (BTM_BUSY);
  } else {
@@ -1904,10 +1905,10 @@ tBTM_STATUS btm_initiate_rem_name(const RawAddress& remote_bda, uint8_t origin,

    /* If the database entry exists for the device, use its clock offset */
    tINQ_DB_ENT* p_i = btm_inq_db_find(remote_bda);
      if (p_i &&
          (p_i->inq_info.results.inq_result_type & BT_DEVICE_TYPE_BREDR)) {
    if (p_i && (p_i->inq_info.results.inq_result_type & BT_DEVICE_TYPE_BREDR)) {
      tBTM_INQ_INFO* p_cur = &p_i->inq_info;
        uint16_t clock_offset = p_cur->results.clock_offset | BTM_CLOCK_OFFSET_VALID;
      uint16_t clock_offset =
          p_cur->results.clock_offset | BTM_CLOCK_OFFSET_VALID;
      int clock_offset_in_cfg = 0;
      if (0 == (p_cur->results.clock_offset & BTM_CLOCK_OFFSET_VALID)) {
        if (btif_get_device_clockoffset(remote_bda, &clock_offset_in_cfg)) {
@@ -1931,9 +1932,6 @@ tBTM_STATUS btm_initiate_rem_name(const RawAddress& remote_bda, uint8_t origin,
    btm_cb.btm_inq_vars.remname_active = true;
    return BTM_CMD_STARTED;
  }
  } else {
    return BTM_ILLEGAL_VALUE;
  }
}

/*******************************************************************************
+0 −1
Original line number Diff line number Diff line
@@ -240,7 +240,6 @@ struct tBTM_INQUIRY_VAR_ST {
  uint16_t page_scan_type; /* current page scan type */

  RawAddress remname_bda; /* Name of bd addr for active remote name request */
#define BTM_RMT_NAME_EXT 0x1 /* Initiated through API */
  bool remname_active; /* State of a remote name request by external API */
  tBT_DEVICE_TYPE remname_dev_type; /* Whether it's LE or BREDR name request */