Skip to content

Commit e53e4cf

Browse files
PavelVPVkartben
authored andcommitted
bluetooth: host: att: Remove att_sent function
`att_sent` is removed as it does not provide any value. All checks are already performed in `att_on_sent_cb`, and keeping it only increases readability complexity. `att_sent` is removed as doesn't give any value. All checks are done already in `att_on_sent_cb`. It just increases readness complexity. Signed-off-by: Pavel Vasilyev <pavel.vasilyev@nordicsemi.no>
1 parent 18b8529 commit e53e4cf

File tree

1 file changed

+14
-25
lines changed
  • subsys/bluetooth/host

1 file changed

+14
-25
lines changed

subsys/bluetooth/host/att.c

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,6 @@ static void bt_att_disconnected(struct bt_l2cap_chan *chan);
295295

296296
struct net_buf *bt_att_create_rsp_pdu(struct bt_att_chan *chan, uint8_t op);
297297

298-
static void bt_att_sent(struct bt_l2cap_chan *ch);
299-
300298
static void att_disconnect(struct bt_att_chan *chan)
301299
{
302300
char addr[BT_ADDR_LE_STR_LEN];
@@ -319,26 +317,6 @@ static void att_disconnect(struct bt_att_chan *chan)
319317
}
320318
}
321319

322-
static void att_sent(void *user_data)
323-
{
324-
struct bt_att_tx_meta_data *data = user_data;
325-
struct bt_att_chan *att_chan = data->att_chan;
326-
struct bt_conn *conn = att_chan->att->conn;
327-
struct bt_l2cap_chan *chan = &att_chan->chan.chan;
328-
329-
__ASSERT_NO_MSG(!bt_att_is_enhanced(att_chan));
330-
331-
LOG_DBG("conn %p chan %p", conn, chan);
332-
333-
/* For EATT, `bt_att_sent` is assigned to the `.sent` L2 callback.
334-
* L2CAP will then call it once the SDU has finished sending.
335-
*
336-
* For UATT, this won't happen, as static LE l2cap channels don't have
337-
* SDUs. Call it manually instead.
338-
*/
339-
bt_att_sent(chan);
340-
}
341-
342320
/* In case of success the ownership of the buffer is transferred to the stack
343321
* which takes care of releasing it when it completes transmitting to the
344322
* controller.
@@ -686,9 +664,20 @@ static void att_on_sent_cb(struct bt_att_tx_meta_data *meta)
686664
}
687665

688666
if (!bt_att_is_enhanced(meta->att_chan)) {
689-
/* For EATT, L2CAP will call it after the SDU is fully sent. */
690-
LOG_DBG("UATT bearer, calling att_sent");
691-
att_sent(meta);
667+
struct bt_att_chan *att_chan = meta->att_chan->att->conn;
668+
struct bt_conn *conn = att_chan->att->conn;
669+
struct bt_l2cap_chan *l2cap_chan = &att_chan->chan.chan;
670+
671+
ARG_UNUSED(conn);
672+
LOG_DBG("UATT bearer, calling bt_att_sent: conn %p chan %p", conn, l2cap_chan);
673+
674+
/* For EATT, `bt_att_sent` is assigned to the `.sent` L2 callback.
675+
* L2CAP will then call it once the SDU has finished sending.
676+
*
677+
* For UATT, this won't happen, as static LE l2cap channels don't have
678+
* SDUs. Call it manually instead.
679+
*/
680+
bt_att_sent(l2cap_chan);
692681
}
693682

694683
switch (op_type) {

0 commit comments

Comments
 (0)