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

Commit 65f25f01 authored by Zach Johnson's avatar Zach Johnson
Browse files

callback param to BTM_SwitchRole is always null, remove it

tetris line clear mode engaged

Bug: 159815595
Tag: #refactor
Test: compile & verify basic functions working
Change-Id: I9c17bdfbd262e39dfb43d59f089b4bb2220c99b3
parent d5ca5dd4
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1102,7 +1102,7 @@ bool bta_av_switch_if_needed(tBTA_AV_SCB* p_scb) {
        if (bta_av_cb.features & BTA_AV_FEAT_MASTER)
          BTA_dm_block_role_switch_for(p_scbi->PeerAddress());
        if (BTM_CMD_STARTED !=
            BTM_SwitchRole(p_scbi->PeerAddress(), HCI_ROLE_MASTER, NULL)) {
            BTM_SwitchRole(p_scbi->PeerAddress(), HCI_ROLE_MASTER)) {
          /* can not switch role on SCBI
           * start the timer on SCB - because this function is ONLY called when
           * SCB gets API_OPEN */
@@ -1147,7 +1147,7 @@ bool bta_av_link_role_ok(tBTA_AV_SCB* p_scb, uint8_t bits) {
        BTA_dm_block_role_switch_for(p_scb->PeerAddress());

      tBTM_STATUS status =
          BTM_SwitchRole(p_scb->PeerAddress(), HCI_ROLE_MASTER, NULL);
          BTM_SwitchRole(p_scb->PeerAddress(), HCI_ROLE_MASTER);
      if (status != BTM_CMD_STARTED) {
        /* can not switch role on SCB - start the timer on SCB */
        LOG_ERROR("%s: peer %s BTM_SwitchRole(HCI_ROLE_MASTER) error: %d",
+3 −3
Original line number Diff line number Diff line
@@ -2502,7 +2502,7 @@ static void handle_role_change(const RawAddress& bd_addr, uint8_t new_role,
      /* more than one connections and the AV connection is role switched
       * to slave
       * switch it back to master and remove the switch policy */
      BTM_SwitchRole(bd_addr, HCI_ROLE_MASTER, NULL);
      BTM_SwitchRole(bd_addr, HCI_ROLE_MASTER);
      need_policy_change = true;
    } else if (p_bta_dm_cfg->avoid_scatter && (new_role == HCI_ROLE_MASTER)) {
      /* if the link updated to be master include AV activities, remove
@@ -2700,7 +2700,7 @@ static void bta_dm_check_av() {
      if ((p_dev->conn_state == BTA_DM_CONNECTED) &&
          (p_dev->info & BTA_DM_DI_AV_ACTIVE)) {
        /* make master and take away the role switch policy */
        BTM_SwitchRole(p_dev->peer_bdaddr, HCI_ROLE_MASTER, nullptr);
        BTM_SwitchRole(p_dev->peer_bdaddr, HCI_ROLE_MASTER);
        /* else either already master or can not switch for some reasons */
        BTA_dm_block_role_switch_for(p_dev->peer_bdaddr);
        break;
@@ -2911,7 +2911,7 @@ static void bta_dm_adjust_roles(bool delay_role_switch) {
                  BTA_SLAVE_ROLE_ONLY &&
              !delay_role_switch) {
            BTM_SwitchRole(bta_dm_cb.device_list.peer_device[i].peer_bdaddr,
                           HCI_ROLE_MASTER, NULL);
                           HCI_ROLE_MASTER);
          } else {
            alarm_set_on_mloop(bta_dm_cb.switch_delay_timer,
                               BTA_DM_SWITCH_DELAY_TIMER_MS,
+2 −5
Original line number Diff line number Diff line
@@ -1209,9 +1209,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role);
 * Function         BTM_SwitchRole
 *
 * Description      This function is called to switch role between master and
 *                  slave.  If role is already set it will do nothing.  If the
 *                  command was initiated, the callback function is called upon
 *                  completion.
 *                  slave.  If role is already set it will do nothing.
 *
 * Returns          BTM_SUCCESS if already in specified role.
 *                  BTM_CMD_STARTED if command issued to controller.
@@ -1222,8 +1220,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role);
 *                                       role switching
 *
 ******************************************************************************/
tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role,
                           tBTM_CMPL_CB* p_cb);
tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role);

/*******************************************************************************
 *
+4 −21
Original line number Diff line number Diff line
@@ -473,9 +473,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role) {
 * Function         BTM_SwitchRole
 *
 * Description      This function is called to switch role between master and
 *                  slave.  If role is already set it will do nothing.  If the
 *                  command was initiated, the callback function is called upon
 *                  completion.
 *                  slave.  If role is already set it will do nothing.
 *
 * Returns          BTM_SUCCESS if already in specified role.
 *                  BTM_CMD_STARTED if command issued to controller.
@@ -487,8 +485,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role) {
 *                  BTM_BUSY if the previous command is not completed
 *
 ******************************************************************************/
tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role,
                           tBTM_CMPL_CB* p_cb) {
tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role) {
  tACL_CONN* p;
  tBTM_SEC_DEV_REC* p_dev_rec = NULL;
  bool is_sco_active;
@@ -496,20 +493,14 @@ tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role,
  tBTM_PM_MODE pwr_mode;
  tBTM_PM_PWR_MD settings;

  LOG_INFO("%s: peer %s new_role=0x%x p_cb=%p p_switch_role_cb=%p", __func__,
           remote_bd_addr.ToString().c_str(), new_role, p_cb,
  LOG_INFO("%s: peer %s new_role=0x%x p_switch_role_cb=%p", __func__,
           remote_bd_addr.ToString().c_str(), new_role,
           btm_cb.devcb.p_switch_role_cb);

  /* Make sure the local device supports switching */
  if (!controller_get_interface()->supports_master_slave_role_switch())
    return (BTM_MODE_UNSUPPORTED);

  if (btm_cb.devcb.p_switch_role_cb && p_cb) {
    VLOG(2) << "Role switch on other device is in progress "
            << btm_cb.devcb.switch_role_ref_data.remote_bd_addr;
    return (BTM_BUSY);
  }

  p = btm_bda_to_acl(remote_bd_addr, BT_TRANSPORT_BR_EDR);
  if (p == NULL) return (BTM_UNKNOWN_ADDR);

@@ -571,14 +562,6 @@ tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role,
    }
  }

  /* Initialize return structure in case request fails */
  if (p_cb) {
    btm_cb.devcb.switch_role_ref_data.remote_bd_addr = remote_bd_addr;
    btm_cb.devcb.switch_role_ref_data.role = new_role;
    /* initialized to an error code */
    btm_cb.devcb.switch_role_ref_data.hci_status = HCI_ERR_UNSUPPORTED_VALUE;
    btm_cb.devcb.p_switch_role_cb = p_cb;
  }
  return (BTM_CMD_STARTED);
}

+2 −5
Original line number Diff line number Diff line
@@ -118,9 +118,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role);
 * Function         BTM_SwitchRole
 *
 * Description      This function is called to switch role between master and
 *                  slave.  If role is already set it will do nothing.  If the
 *                  command was initiated, the callback function is called upon
 *                  completion.
 *                  slave.  If role is already set it will do nothing.
 *
 * Returns          BTM_SUCCESS if already in specified role.
 *                  BTM_CMD_STARTED if command issued to controller.
@@ -131,8 +129,7 @@ tBTM_STATUS BTM_GetRole(const RawAddress& remote_bd_addr, uint8_t* p_role);
 *                                       role switching
 *
 ******************************************************************************/
tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role,
                           tBTM_CMPL_CB* p_cb);
tBTM_STATUS BTM_SwitchRole(const RawAddress& remote_bd_addr, uint8_t new_role);

/*******************************************************************************
 *
Loading