Skip to content

Commit f9e2fc3

Browse files
Thalleycfriedt
authored andcommitted
Bluetooth: ISO: Move bt_iso_accept and make static
Move the function and make it static as it is only used in iso.c and for unicast only. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 1ebd6b5 commit f9e2fc3

File tree

2 files changed

+35
-38
lines changed

2 files changed

+35
-38
lines changed

subsys/bluetooth/host/iso.c

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,40 @@ static bool valid_chan_io_qos(const struct bt_iso_chan_io_qos *io_qos,
706706
}
707707

708708
#if defined(CONFIG_BT_ISO_UNICAST)
709+
static int iso_accept(struct bt_conn *acl, struct bt_conn *iso)
710+
{
711+
struct bt_iso_accept_info accept_info;
712+
struct bt_iso_chan *chan;
713+
int err;
714+
715+
CHECKIF(!iso || iso->type != BT_CONN_TYPE_ISO) {
716+
BT_DBG("Invalid parameters: iso %p iso->type %u", iso,
717+
iso ? iso->type : 0);
718+
return -EINVAL;
719+
}
720+
721+
BT_DBG("%p", iso);
722+
723+
if (!iso_server) {
724+
return -ENOMEM;
725+
}
726+
727+
accept_info.acl = acl;
728+
accept_info.cig_id = iso->iso.cig_id;
729+
accept_info.cis_id = iso->iso.cis_id;
730+
731+
err = iso_server->accept(&accept_info, &chan);
732+
if (err < 0) {
733+
BT_ERR("Server failed to accept: %d", err);
734+
return err;
735+
}
736+
737+
bt_iso_chan_add(iso, chan);
738+
bt_iso_chan_set_state(chan, BT_ISO_CONNECT);
739+
740+
return 0;
741+
}
742+
709743
static bool valid_chan_qos(const struct bt_iso_chan_qos *qos)
710744
{
711745
if (qos->rx != NULL) {
@@ -859,7 +893,7 @@ void hci_le_cis_req(struct net_buf *buf)
859893
iso->iso.cis_id = evt->cis_id;
860894

861895
/* Request application to accept */
862-
err = bt_iso_accept(acl, iso);
896+
err = iso_accept(acl, iso);
863897
if (err) {
864898
BT_DBG("App rejected ISO %d", err);
865899
bt_conn_unref(iso);
@@ -1237,40 +1271,6 @@ static int hci_le_create_cis(const struct bt_iso_connect_param *param,
12371271
return bt_hci_cmd_send_sync(BT_HCI_OP_LE_CREATE_CIS, buf, NULL);
12381272
}
12391273

1240-
int bt_iso_accept(struct bt_conn *acl, struct bt_conn *iso)
1241-
{
1242-
struct bt_iso_accept_info accept_info;
1243-
struct bt_iso_chan *chan;
1244-
int err;
1245-
1246-
CHECKIF(!iso || iso->type != BT_CONN_TYPE_ISO) {
1247-
BT_DBG("Invalid parameters: iso %p iso->type %u", iso,
1248-
iso ? iso->type : 0);
1249-
return -EINVAL;
1250-
}
1251-
1252-
BT_DBG("%p", iso);
1253-
1254-
if (!iso_server) {
1255-
return -ENOMEM;
1256-
}
1257-
1258-
accept_info.acl = acl;
1259-
accept_info.cig_id = iso->iso.cig_id;
1260-
accept_info.cis_id = iso->iso.cis_id;
1261-
1262-
err = iso_server->accept(&accept_info, &chan);
1263-
if (err < 0) {
1264-
BT_ERR("Server failed to accept: %d", err);
1265-
return err;
1266-
}
1267-
1268-
bt_iso_chan_add(iso, chan);
1269-
bt_iso_chan_set_state(chan, BT_ISO_CONNECT);
1270-
1271-
return 0;
1272-
}
1273-
12741274
int bt_iso_chan_connect(const struct bt_iso_connect_param *param, size_t count)
12751275
{
12761276
int err;

subsys/bluetooth/host/iso_internal.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ void hci_le_big_sync_established(struct net_buf *buf);
9494
/** Process BIG sync lost event */
9595
void hci_le_big_sync_lost(struct net_buf *buf);
9696

97-
/* Notify ISO channels of a new connection */
98-
int bt_iso_accept(struct bt_conn *acl, struct bt_conn *iso);
99-
10097
/* Notify ISO channels of a new connection */
10198
void bt_iso_connected(struct bt_conn *iso);
10299

0 commit comments

Comments
 (0)