Skip to content

Commit 19099fc

Browse files
cvinayakcfriedt
authored andcommitted
Bluetooth: Controller: Use define for invalid LLL context handle
Use a define for invalid LLL context handle instead of 0xFFFF magic value. Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 631cc82 commit 19099fc

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

subsys/bluetooth/controller/ll_sw/lll.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,9 @@ struct node_rx_iso_meta {
307307
/* Define invalid/unassigned Controller state/role instance handle */
308308
#define NODE_RX_HANDLE_INVALID 0xFFFF
309309

310+
/* Define invalid/unassigned Controller LLL context handle */
311+
#define LLL_HANDLE_INVALID 0xFFFF
312+
310313
/* Header of node_rx_pdu */
311314
struct node_rx_hdr {
312315
union {

subsys/bluetooth/controller/ll_sw/ull_conn.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1199,7 +1199,7 @@ void ull_conn_done(struct node_rx_event_done *done)
11991199
lll = &conn->lll;
12001200

12011201
/* Skip if connection terminated by local host */
1202-
if (unlikely(lll->handle == 0xFFFF)) {
1202+
if (unlikely(lll->handle == LLL_HANDLE_INVALID)) {
12031203
return;
12041204
}
12051205

@@ -1541,7 +1541,7 @@ void ull_conn_tx_demux(uint8_t count)
15411541
struct pdu_data *p = (void *)tx->pdu;
15421542

15431543
p->ll_id = PDU_DATA_LLID_RESV;
1544-
ll_tx_ack_put(0xFFFF, tx);
1544+
ll_tx_ack_put(LLL_HANDLE_INVALID, tx);
15451545
}
15461546

15471547
#if defined(CONFIG_BT_CTLR_LLID_DATA_START_EMPTY)
@@ -1657,7 +1657,7 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx)
16571657
LL_ASSERT(pdu_tx->len);
16581658

16591659
if (pdu_tx->ll_id == PDU_DATA_LLID_CTRL) {
1660-
if (handle != 0xFFFF) {
1660+
if (handle != LLL_HANDLE_INVALID) {
16611661
struct ll_conn *conn = ll_conn_get(handle);
16621662

16631663
ctrl_tx_ack(conn, &tx, pdu_tx);
@@ -1675,10 +1675,10 @@ void ull_conn_tx_ack(uint16_t handle, memq_link_t *link, struct node_tx *tx)
16751675
} else {
16761676
LL_ASSERT(!link->next);
16771677
}
1678-
} else if (handle == 0xFFFF) {
1678+
} else if (handle == LLL_HANDLE_INVALID) {
16791679
pdu_tx->ll_id = PDU_DATA_LLID_RESV;
16801680
} else {
1681-
LL_ASSERT(handle != 0xFFFF);
1681+
LL_ASSERT(handle != LLL_HANDLE_INVALID);
16821682
}
16831683

16841684
ll_tx_ack_put(handle, tx);
@@ -1982,7 +1982,7 @@ static void conn_cleanup_finalize(struct ll_conn *conn)
19821982
(ticker_status == TICKER_STATUS_BUSY));
19831983

19841984
/* Invalidate the connection context */
1985-
lll->handle = 0xFFFF;
1985+
lll->handle = LLL_HANDLE_INVALID;
19861986

19871987
/* Demux and flush Tx PDUs that remain enqueued in thread context */
19881988
ull_conn_tx_demux(UINT8_MAX);
@@ -2123,7 +2123,7 @@ static void tx_lll_flush(void *param)
21232123
idx = MFIFO_ENQUEUE_GET(conn_ack, (void **)&lll_tx);
21242124
LL_ASSERT(lll_tx);
21252125

2126-
lll_tx->handle = 0xFFFF;
2126+
lll_tx->handle = LLL_HANDLE_INVALID;
21272127
lll_tx->node = tx;
21282128

21292129
/* TX node UPSTREAM, i.e. Tx node ack path */

0 commit comments

Comments
 (0)