Skip to content

Commit ac88899

Browse files
jori-nordicnashif
authored andcommitted
Bluetooth: Host: Remove an indentation level in auto procedures
The else branch was unused. Signed-off-by: Jonathan Rico <[email protected]>
1 parent 585c1f9 commit ac88899

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

include/zephyr/drivers/bluetooth.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ enum {
4646
* initial connection data length parameters are not equal to the
4747
* default data length parameters. Therefore the host should initiate
4848
* the DLE procedure after connection establishment.
49+
*
50+
* That requirement is stated in Core Spec v5.4 Vol 6 Part B. 4.5.10
51+
* Data PDU length management:
52+
*
53+
* > For a new connection:
54+
* > - ... If either value is not 27, then the Controller should
55+
* > initiate the Data Length Update procedure at the earliest
56+
* > practical opportunity.
4957
*/
5058
BT_HCI_QUIRK_NO_AUTO_DLE = BIT(1),
5159
};

subsys/bluetooth/host/conn.c

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1764,23 +1764,20 @@ static void perform_auto_initiated_procedures(struct bt_conn *conn, void *unused
17641764
}
17651765
}
17661766

1767+
/* Data length should be automatically updated to the maximum by the
1768+
* controller. Not updating it is a quirk and this is the workaround.
1769+
*/
17671770
if (IS_ENABLED(CONFIG_BT_AUTO_DATA_LEN_UPDATE) &&
1768-
BT_FEAT_LE_DLE(bt_dev.le.features)) {
1769-
if (bt_drv_quirk_no_auto_dle()) {
1770-
uint16_t tx_octets, tx_time;
1771-
1772-
err = bt_hci_le_read_max_data_len(&tx_octets, &tx_time);
1773-
if (!err) {
1774-
err = bt_le_set_data_len(conn,
1775-
tx_octets, tx_time);
1776-
if (err) {
1777-
LOG_ERR("Failed to set data len (%d)", err);
1778-
}
1771+
BT_FEAT_LE_DLE(bt_dev.le.features) &&
1772+
bt_drv_quirk_no_auto_dle()) {
1773+
uint16_t tx_octets, tx_time;
1774+
1775+
err = bt_hci_le_read_max_data_len(&tx_octets, &tx_time);
1776+
if (!err) {
1777+
err = bt_le_set_data_len(conn, tx_octets, tx_time);
1778+
if (err) {
1779+
LOG_ERR("Failed to set data len (%d)", err);
17791780
}
1780-
} else {
1781-
/* No need to auto-initiate DLE procedure.
1782-
* It is done by the controller.
1783-
*/
17841781
}
17851782
}
17861783

0 commit comments

Comments
 (0)