@@ -258,31 +258,26 @@ int hci_le_remove_cig(uint8_t cig_id)
258258
259259void bt_iso_cleanup (struct bt_conn * conn )
260260{
261+ struct bt_conn_iso * iso = bt_conn_iso (conn );
261262 int i ;
262263
263- CHECKIF (!conn || conn -> type != BT_CONN_TYPE_ISO ) {
264- BT_DBG ("Invalid parameters: conn %p conn->type %u" , conn ,
265- conn ? conn -> type : 0 );
266- return ;
267- }
268-
269264 BT_DBG ("%p" , conn );
270265
271266 /* Check if ISO connection is in fact a BIS */
272- if (!conn -> iso . acl ) {
267+ if (!iso -> acl ) {
273268 goto done ;
274269 }
275270
276271 /* If ACL is still connected there are channels to serve that means the
277272 * connection is still in use.
278273 */
279- if (conn -> iso . acl -> state == BT_CONN_CONNECTED &&
274+ if (iso -> acl -> state == BT_CONN_CONNECTED &&
280275 !sys_slist_is_empty (& conn -> channels )) {
281276 goto done ;
282277 }
283278
284- bt_conn_unref (conn -> iso . acl );
285- conn -> iso . acl = NULL ;
279+ bt_conn_unref (iso -> acl );
280+ iso -> acl = NULL ;
286281
287282 /* Check if conn is last of CIG */
288283 for (i = 0 ; i < CONFIG_BT_ISO_MAX_CHAN ; i ++ ) {
@@ -1183,6 +1178,17 @@ int bt_iso_chan_send(struct bt_iso_chan *chan, struct net_buf *buf)
11831178 return bt_conn_send (chan -> conn , buf );
11841179}
11851180
1181+ struct bt_conn_iso * bt_conn_iso (struct bt_conn * conn )
1182+ {
1183+ CHECKIF (!conn || conn -> type != BT_CONN_TYPE_ISO ) {
1184+ BT_DBG ("Invalid parameters: conn %p conn->type %u" , conn ,
1185+ conn ? conn -> type : 0 );
1186+ return NULL ;
1187+ }
1188+
1189+ return & conn -> iso ;
1190+ }
1191+
11861192#if defined(CONFIG_BT_ISO_BROADCAST )
11871193
11881194static struct bt_iso_big * get_free_big (void )
0 commit comments