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

Commit 941bb283 authored by Archie Pusaka's avatar Archie Pusaka
Browse files

Simplify call to bta_hh_co_data

Out of 8 input parameters to this function, only 3 are actually used,
the rest 5 are either unused or only used to log some uninteresting
event. Remove them to simplify the following patches.

Bug: 291522341
Test: mmm packages/modules/Bluetooth
Flag: EXEMPT removing dead code

Change-Id: I670cbbee202fca9d2a45ee758e1e659be018f61c
parent 1c201bc4
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -655,8 +655,7 @@ void bta_hh_data_act(tBTA_HH_DEV_CB* p_cb, const tBTA_HH_DATA* p_data) {
  uint8_t* p_rpt = (uint8_t*)(pdata + 1) + pdata->offset;

  bta_hh_co_data((uint8_t)p_data->hid_cback.hdr.layer_specific, p_rpt,
                 pdata->len, p_cb->mode, p_cb->sub_class,
                 p_cb->dscp_info.ctry_code, p_cb->link_spec, p_cb->app_id);
                 pdata->len);

  osi_free_and_reset((void**)&pdata);
}
+2 −14
Original line number Diff line number Diff line
@@ -1634,7 +1634,6 @@ static void bta_hh_le_srvc_search_cmpl(tBTA_GATTC_SEARCH_CMPL* p_data) {
 ******************************************************************************/
static void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY* p_data) {
  tBTA_HH_DEV_CB* p_dev_cb = bta_hh_le_find_dev_cb_by_conn_id(p_data->conn_id);
  uint8_t app_id;
  uint8_t* p_buf;
  tBTA_HH_LE_RPT* p_rpt;

@@ -1651,8 +1650,6 @@ static void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY* p_data) {
    return;
  }

  app_id = p_dev_cb->app_id;

  const gatt::Service* p_svc =
      BTA_GATTC_GetOwningService(p_dev_cb->conn_id, p_char->value_handle);

@@ -1670,11 +1667,6 @@ static void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY* p_data) {
    return;
  }

  if (p_char->uuid == Uuid::From16Bit(GATT_UUID_HID_BT_MOUSE_INPUT))
    app_id = BTA_HH_APP_ID_MI;
  else if (p_char->uuid == Uuid::From16Bit(GATT_UUID_HID_BT_KB_INPUT))
    app_id = BTA_HH_APP_ID_KB;

  log::verbose("report ID: {}", p_rpt->rpt_id);

  /* need to append report ID to the head of data */
@@ -1688,9 +1680,7 @@ static void bta_hh_le_input_rpt_notify(tBTA_GATTC_NOTIFY* p_data) {
    p_buf = p_data->value;
  }

  bta_hh_co_data((uint8_t)p_dev_cb->hid_handle, p_buf, p_data->len,
                 p_dev_cb->mode, 0, /* no sub class*/
                 p_dev_cb->dscp_info.ctry_code, p_dev_cb->link_spec, app_id);
  bta_hh_co_data((uint8_t)p_dev_cb->hid_handle, p_buf, p_data->len);

  if (p_buf != p_data->value) osi_free(p_buf);
}
@@ -2370,8 +2360,6 @@ static bool bta_hh_le_iso_data_callback(const RawAddress& addr,
    return false;
  }

  bta_hh_co_data(p_dev_cb->hid_handle, data, size, p_dev_cb->mode, 0,
                 p_dev_cb->dscp_info.ctry_code, p_dev_cb->link_spec,
                 BTA_HH_APP_ID_LE);
  bta_hh_co_data(p_dev_cb->hid_handle, data, size);
  return true;
}
+4 −4
Original line number Diff line number Diff line
@@ -45,14 +45,14 @@ typedef struct {
 *                  received
 *                  in interupt channel.
 *
 * Parameters       dev_handle  - device handle
 *                  *p_rpt      - pointer to the report data
 *                  len         - length of report data
 *
 * Returns          void.
 *
 ******************************************************************************/
void bta_hh_co_data(uint8_t dev_handle, uint8_t* p_rpt, uint16_t len,
                    tBTA_HH_PROTO_MODE mode, uint8_t sub_class,
                    uint8_t ctry_code, const tAclLinkSpec& link_spec,
                    uint8_t app_id);
void bta_hh_co_data(uint8_t dev_handle, uint8_t* p_rpt, uint16_t len);

/*******************************************************************************
 *
+2 −11
Original line number Diff line number Diff line
@@ -530,22 +530,13 @@ void bta_hh_co_close(btif_hh_device_t* p_dev) {
 * Parameters       dev_handle  - device handle
 *                  *p_rpt      - pointer to the report data
 *                  len         - length of report data
 *                  mode        - Hid host Protocol Mode
 *                  sub_clas    - Device Subclass
 *                  app_id      - application id
 *
 * Returns          void
 ******************************************************************************/
void bta_hh_co_data(uint8_t dev_handle, uint8_t* p_rpt, uint16_t len,
                    tBTA_HH_PROTO_MODE mode, uint8_t sub_class,
                    uint8_t ctry_code, const tAclLinkSpec& /* link_spec */,
                    uint8_t app_id) {
void bta_hh_co_data(uint8_t dev_handle, uint8_t* p_rpt, uint16_t len) {
  btif_hh_device_t* p_dev;

  log::verbose(
      "dev_handle = {}, subclass = 0x{:02X}, mode = {}, ctry_code = {}, app_id "
      "= {}",
      dev_handle, sub_class, mode, ctry_code, app_id);
  log::verbose("dev_handle = {}", dev_handle);

  p_dev = btif_hh_find_connected_dev_by_handle(dev_handle);
  if (p_dev == NULL) {
+1 −3
Original line number Diff line number Diff line
@@ -41,9 +41,7 @@ void bta_hh_co_close(btif_hh_device_t* /* p_dev */) {
  inc_func_call_count(__func__);
}
void bta_hh_co_data(uint8_t /* dev_handle */, uint8_t* /* p_rpt */,
                    uint16_t /* len */, tBTA_HH_PROTO_MODE /* mode */,
                    uint8_t /* sub_class */, uint8_t /* ctry_code */,
                    const tAclLinkSpec& /* link_spec */, uint8_t /* app_id */) {
                    uint16_t /* len */) {
  inc_func_call_count(__func__);
}
void bta_hh_co_get_rpt_rsp(uint8_t /* dev_handle */, uint8_t /* status */,