From bd07b7ee8393742477e476b88650e687c6f833d0 Mon Sep 17 00:00:00 2001 From: Chris Manton Date: Fri, 21 Aug 2020 10:08:52 -0700 Subject: [PATCH] Colocate dec/def stack/l2cap/l2c_link::l2c_link_send_to_lower Towards proper interfaces Bug: 163134718 Tag: #refactor Test: compile & verify basic functions working Change-Id: I63693185bf9450ef94de4863d90bda1ef6315ee8 --- stack/l2cap/l2c_link.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/stack/l2cap/l2c_link.cc b/stack/l2cap/l2c_link.cc index cd569f23b..525496dff 100644 --- a/stack/l2cap/l2c_link.cc +++ b/stack/l2cap/l2c_link.cc @@ -1013,8 +1013,6 @@ void l2c_OnHciModeChangeSendPendingPackets(RawAddress remote) { ******************************************************************************/ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf, tL2C_TX_COMPLETE_CB_INFO* p_cbi) { - uint16_t num_segs; - uint16_t xmit_window, acl_data_size; const controller_t* controller = controller_get_interface(); if ((p_buf->len <= controller->get_acl_packet_size_classic() && @@ -1039,6 +1037,8 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf, bte_main_hci_send(p_buf, BT_EVT_TO_LM_HCI_ACL); } } else { + uint16_t xmit_window{0}; + uint16_t acl_data_size{0}; if (p_lcb->transport == BT_TRANSPORT_LE) { acl_data_size = controller->get_acl_data_size_ble(); xmit_window = l2cb.controller_le_xmit_window; @@ -1047,8 +1047,9 @@ static void l2c_link_send_to_lower(tL2C_LCB* p_lcb, BT_HDR* p_buf, acl_data_size = controller->get_acl_data_size_classic(); xmit_window = l2cb.controller_xmit_window; } - num_segs = (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size - 1) / - acl_data_size; + uint16_t num_segs = + (p_buf->len - HCI_DATA_PREAMBLE_SIZE + acl_data_size - 1) / + acl_data_size; /* If doing round-robin, then only 1 segment each time */ if (p_lcb->link_xmit_quota == 0) { -- 2.11.0