Bluetooth: Host: direction: 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 <johan.hedberg@silabs.com>
This commit is contained in:
Johan Hedberg 2025-06-19 03:58:05 +03:00 committed by Dan Kalowsky
parent e23d5a0801
commit 6f2643638d

View File

@ -129,8 +129,7 @@ static int hci_df_set_cl_cte_tx_params(const struct bt_le_ext_adv *adv,
return -EINVAL;
}
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_PARAMS,
sizeof(*cp) + params->num_ant_ids);
buf = bt_hci_cmd_alloc(K_FOREVER);
if (!buf) {
return -ENOBUFS;
}
@ -216,7 +215,7 @@ static int hci_df_set_adv_cte_tx_enable(struct bt_le_ext_adv *adv,
struct bt_hci_cmd_state_set state;
struct net_buf *buf;
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_TX_ENABLE, sizeof(*cp));
buf = bt_hci_cmd_alloc(K_FOREVER);
if (!buf) {
return -ENOBUFS;
}
@ -296,9 +295,7 @@ prepare_cl_cte_rx_enable_cmd_params(struct net_buf **buf, struct bt_le_per_adv_s
/* If CTE Rx is enabled, command parameters total length must include
* antenna ids, so command size if extended by num_and_ids.
*/
*buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CL_CTE_SAMPLING_ENABLE,
(sizeof(struct bt_hci_cp_le_set_cl_cte_sampling_enable) +
(enable ? switch_pattern_len : 0)));
*buf = bt_hci_cmd_alloc(K_FOREVER);
if (!(*buf)) {
return -ENOBUFS;
}
@ -528,7 +525,6 @@ static int hci_df_set_conn_cte_tx_param(struct bt_conn *conn,
struct bt_hci_rp_le_set_conn_cte_tx_params *rp;
struct bt_hci_cmd_state_set state;
struct net_buf *buf, *rsp;
uint8_t num_ant_ids;
int err;
/* If AoD is not enabled, ant_ids are ignored by controller:
@ -538,11 +534,7 @@ static int hci_df_set_conn_cte_tx_param(struct bt_conn *conn,
return -EINVAL;
}
num_ant_ids = ((params->cte_types & (BT_DF_CTE_TYPE_AOD_1US | BT_DF_CTE_TYPE_AOD_2US)) ?
params->num_ant_ids : 0);
buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_TX_PARAMS,
sizeof(struct bt_hci_cp_le_set_conn_cte_tx_params) + num_ant_ids);
buf = bt_hci_cmd_alloc(K_FOREVER);
if (!buf) {
return -ENOBUFS;
}
@ -587,9 +579,7 @@ static int prepare_conn_cte_rx_enable_cmd_params(struct net_buf **buf, struct bt
/* If CTE Rx is enabled, command parameters total length must include
* antenna ids, so command size if extended by num_and_ids.
*/
*buf = bt_hci_cmd_create(BT_HCI_OP_LE_SET_CONN_CTE_RX_PARAMS,
(sizeof(struct bt_hci_cp_le_set_conn_cte_rx_params) +
(enable ? switch_pattern_len : 0)));
*buf = bt_hci_cmd_alloc(K_FOREVER);
if (!(*buf)) {
return -ENOBUFS;
}
@ -823,8 +813,7 @@ static int hci_df_set_conn_cte_req_enable(struct bt_conn *conn, bool enable,
return -EINVAL;
}
buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_CTE_REQ_ENABLE,
sizeof(struct bt_hci_cp_le_conn_cte_req_enable));
buf = bt_hci_cmd_alloc(K_FOREVER);
if (!buf) {
return -ENOBUFS;
}
@ -909,8 +898,7 @@ static int hci_df_set_conn_cte_rsp_enable(struct bt_conn *conn, bool enable)
struct net_buf *buf, *rsp;
int err;
buf = bt_hci_cmd_create(BT_HCI_OP_LE_CONN_CTE_RSP_ENABLE,
sizeof(struct bt_hci_cp_le_conn_cte_rsp_enable));
buf = bt_hci_cmd_alloc(K_FOREVER);
if (!buf) {
return -ENOBUFS;
}