Skip to content

Commit dcd1e6a

Browse files
committed
Bluetooth: ISO: Cleanup BIG before stopped callback
Modify the big_disconnect function to do cleanup_big before calling the `stopped` callback. This will allow the ISO channels, as well as the BIG itself, to be reused for other purposes directly in the stopped callback, without having to offload such actions to a separate thread. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 4bf0381 commit dcd1e6a

File tree

1 file changed

+5
-8
lines changed
  • subsys/bluetooth/host

1 file changed

+5
-8
lines changed

subsys/bluetooth/host/iso.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2719,6 +2719,11 @@ static void big_disconnect(struct bt_iso_big *big, uint8_t reason)
27192719
bt_iso_chan_disconnected(bis, reason);
27202720
}
27212721

2722+
/* Cleanup the BIG before calling the `stopped` so that the `big` pointer and the ISO
2723+
* channels in the `big` can be reused in the callback
2724+
*/
2725+
cleanup_big(big);
2726+
27222727
if (!sys_slist_is_empty(&iso_big_cbs)) {
27232728
struct bt_iso_big_cb *listener;
27242729

@@ -3135,7 +3140,6 @@ void hci_le_big_complete(struct net_buf *buf)
31353140
big = big_lookup_flag(BT_BIG_PENDING);
31363141
if (big) {
31373142
big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED);
3138-
cleanup_big(big);
31393143
}
31403144

31413145
return;
@@ -3153,7 +3157,6 @@ void hci_le_big_complete(struct net_buf *buf)
31533157
big->num_bis);
31543158
}
31553159
big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED);
3156-
cleanup_big(big);
31573160
return;
31583161
}
31593162

@@ -3193,7 +3196,6 @@ void hci_le_big_terminate(struct net_buf *buf)
31933196
LOG_DBG("BIG[%u] %p terminated", big->handle, big);
31943197

31953198
big_disconnect(big, evt->reason);
3196-
cleanup_big(big);
31973199
}
31983200
#endif /* CONFIG_BT_ISO_BROADCASTER */
31993201

@@ -3280,7 +3282,6 @@ int bt_iso_big_terminate(struct bt_iso_big *big)
32803282

32813283
if (!err) {
32823284
big_disconnect(big, BT_HCI_ERR_LOCALHOST_TERM_CONN);
3283-
cleanup_big(big);
32843285
}
32853286
} else {
32863287
err = -EINVAL;
@@ -3325,7 +3326,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
33253326
big = big_lookup_flag(BT_BIG_SYNCING);
33263327
if (big) {
33273328
big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED);
3328-
cleanup_big(big);
33293329
}
33303330

33313331
return;
@@ -3343,7 +3343,6 @@ void hci_le_big_sync_established(struct net_buf *buf)
33433343
big->num_bis);
33443344
}
33453345
big_disconnect(big, evt->status ? evt->status : BT_HCI_ERR_UNSPECIFIED);
3346-
cleanup_big(big);
33473346
return;
33483347
}
33493348

@@ -3383,7 +3382,6 @@ void hci_le_big_sync_lost(struct net_buf *buf)
33833382
LOG_DBG("BIG[%u] %p sync lost", big->handle, big);
33843383

33853384
big_disconnect(big, evt->reason);
3386-
cleanup_big(big);
33873385
}
33883386

33893387
static int hci_le_big_create_sync(const struct bt_le_per_adv_sync *sync, struct bt_iso_big *big,
@@ -3575,7 +3573,6 @@ void bt_iso_reset(void)
35753573
struct bt_iso_big *big = &bigs[i];
35763574

35773575
big_disconnect(big, BT_HCI_ERR_UNSPECIFIED);
3578-
cleanup_big(big);
35793576
}
35803577
#endif /* CONFIG_BT_ISO_BROADCAST */
35813578
}

0 commit comments

Comments
 (0)