From e9f06126ea334e6a7febfdc237be865c15e3b16f Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Thu, 19 Jun 2025 04:00:11 +0300 Subject: [PATCH] Bluetooth: Host: iso: Use bt_hci_cmd_alloc() Use bt_hci_cmd_alloc() instead of the soon to be deprecated bt_hci_cmd_create(). Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/iso.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/subsys/bluetooth/host/iso.c b/subsys/bluetooth/host/iso.c index ffdf3ec0736..eb6eaa78350 100644 --- a/subsys/bluetooth/host/iso.c +++ b/subsys/bluetooth/host/iso.c @@ -196,7 +196,7 @@ static int hci_le_setup_iso_data_path(const struct bt_conn *iso, uint8_t dir, uint8_t *cc; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SETUP_ISO_PATH, sizeof(*cp) + path->cc_len); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -345,7 +345,7 @@ static int hci_le_remove_iso_data_path(struct bt_conn *iso, uint8_t dir) struct net_buf *buf, *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REMOVE_ISO_PATH, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1061,7 +1061,7 @@ int bt_iso_chan_get_tx_sync(const struct bt_iso_chan *chan, struct bt_iso_tx_inf return -ENOTCONN; } - buf = bt_hci_cmd_create(BT_HCI_OP_LE_READ_ISO_TX_SYNC, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOMEM; } @@ -1491,7 +1491,7 @@ static int hci_le_reject_cis(uint16_t handle, uint8_t reason) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REJECT_CIS, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1514,7 +1514,7 @@ static int hci_le_accept_cis(uint16_t handle) struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_ACCEPT_CIS, sizeof(*cp)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1683,7 +1683,7 @@ static int hci_le_remove_cig(uint8_t cig_id) struct bt_hci_cp_le_remove_cig *req; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_REMOVE_CIG, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -1706,8 +1706,7 @@ static struct net_buf *hci_le_set_cig_params(const struct bt_iso_cig *cig, struct net_buf *rsp; int i, err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CIG_PARAMS, - sizeof(*req) + sizeof(*cis_param) * param->num_cis); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return NULL; } @@ -1795,8 +1794,7 @@ static struct net_buf *hci_le_set_cig_test_params(const struct bt_iso_cig *cig, struct net_buf *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CIG_PARAMS_TEST, - sizeof(*req) + sizeof(*cis_param) * param->num_cis); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return NULL; } @@ -2444,7 +2442,7 @@ static int hci_le_create_cis(const struct bt_iso_connect_param *param, size_t co struct bt_hci_cp_le_create_cis *req; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_CIS, sizeof(*req) + sizeof(*cis) * count); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -2784,7 +2782,7 @@ static int hci_le_create_big(struct bt_le_ext_adv *padv, struct bt_iso_big *big, int err; struct bt_iso_chan *bis; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_BIG, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; @@ -2844,7 +2842,7 @@ static int hci_le_create_big_test(const struct bt_le_ext_adv *padv, struct bt_is struct net_buf *buf; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_CREATE_BIG_TEST, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; @@ -3198,7 +3196,7 @@ static int hci_le_terminate_big(struct bt_iso_big *big) struct bt_hci_cp_le_terminate_big *req; struct net_buf *buf; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_TERMINATE_BIG, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3218,7 +3216,7 @@ static int hci_le_big_sync_term(struct bt_iso_big *big) struct net_buf *rsp; int err; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_BIG_TERMINATE_SYNC, sizeof(*req)); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; } @@ -3391,7 +3389,7 @@ static int hci_le_big_create_sync(const struct bt_le_per_adv_sync *sync, struct int err; uint8_t bit_idx = 0; - buf = bt_hci_cmd_create(BT_HCI_OP_LE_BIG_CREATE_SYNC, sizeof(*req) + big->num_bis); + buf = bt_hci_cmd_alloc(K_FOREVER); if (!buf) { return -ENOBUFS; }