Skip to content

Commit

Permalink
Bluetooth: Host: Add helper bt_att_is_enhanced
Browse files Browse the repository at this point in the history
This is a refactor. Hopefully, it makes the code easier to maintain.

Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
  • Loading branch information
alwa-nordic authored and carlescufi committed Apr 24, 2023
1 parent d4d0956 commit fa9d41f
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions subsys/bluetooth/host/att.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ struct bt_att_chan {
sys_snode_t node;
};

static bool bt_att_is_enhanced(struct bt_att_chan *chan)
{
/* Optimization. */
if (!IS_ENABLED(CONFIG_BT_EATT)) {
return false;
}

return atomic_test_bit(chan->flags, ATT_ENHANCED);
}

static uint16_t bt_att_mtu(struct bt_att_chan *chan)
{
return chan->chan.tx.mtu;
Expand Down Expand Up @@ -3039,11 +3049,8 @@ static void bt_att_connected(struct bt_l2cap_chan *chan)

atomic_set_bit(att_chan->flags, ATT_CONNECTED);

if (0) {
#if defined(CONFIG_BT_EATT)
} else if (atomic_test_bit(att_chan->flags, ATT_ENHANCED)) {
if (bt_att_is_enhanced(att_chan)) {
cap_eatt_mtu(le_chan);
#endif
} else {
le_chan->tx.mtu = BT_ATT_DEFAULT_LE_MTU;
le_chan->rx.mtu = BT_ATT_DEFAULT_LE_MTU;
Expand Down

0 comments on commit fa9d41f

Please sign in to comment.