Bluetooth: Host: Refactor tx_notify, use `CONTAINER_OF`
The cast from `sys_snode_t` to `struct bt_conn_tx` assumes `node` is the
first field in `struct bt_conn_tx`. It's better to future-proof this by
using `CONTAINER_OF` to locate `node`.
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
diff --git a/subsys/bluetooth/host/conn.c b/subsys/bluetooth/host/conn.c
index 39d7140..a910240 100644
--- a/subsys/bluetooth/host/conn.c
+++ b/subsys/bluetooth/host/conn.c
@@ -200,7 +200,8 @@
break;
}
- tx = (void *)sys_slist_get_not_empty(&conn->tx_complete);
+ tx = CONTAINER_OF(sys_slist_get_not_empty(&conn->tx_complete),
+ struct bt_conn_tx, node);
irq_unlock(key);
BT_DBG("tx %p cb %p user_data %p", tx, tx->cb, tx->user_data);