Skip to content

Commit 0d9bd8c

Browse files
jhedbergolivier-le-sage
authored andcommitted
[nrf fromtree] Bluetooth: drivers: 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 <[email protected]> (cherry picked from commit c186a31)
1 parent 8ee0255 commit 0d9bd8c

File tree

9 files changed

+15
-19
lines changed

9 files changed

+15
-19
lines changed

drivers/bluetooth/hci/apollox_blue.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,7 @@ static int bt_apollo_set_nvds(void)
396396
#else
397397
uint8_t *p;
398398

399-
buf = bt_hci_cmd_create(HCI_VSC_UPDATE_NVDS_CFG_CMD_OPCODE,
400-
HCI_VSC_UPDATE_NVDS_CFG_CMD_LENGTH);
399+
buf = bt_hci_cmd_alloc(K_FOREVER);
401400
if (!buf) {
402401
return -ENOBUFS;
403402
}

drivers/bluetooth/hci/h4_ifx_cyw43xxx.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ static int bt_update_controller_baudrate(const struct device *bt_uart_dev, uint3
122122
/* Allocate buffer for update uart baudrate command.
123123
* It will be BT_HCI_OP_RESET with extra parameters.
124124
*/
125-
buf = bt_hci_cmd_create(BT_HCI_VND_OP_UPDATE_BAUDRATE,
126-
HCI_VSC_UPDATE_BAUD_RATE_LENGTH);
125+
buf = bt_hci_cmd_alloc(K_FOREVER);
127126
if (buf == NULL) {
128127
LOG_ERR("Unable to allocate command buffer");
129128
return -ENOMEM;
@@ -172,7 +171,7 @@ static int bt_firmware_download(const uint8_t *firmware_image, uint32_t size)
172171
uint16_t op_code = *(uint16_t *)data;
173172

174173
/* Allocate buffer for hci_write_ram/hci_launch_ram command. */
175-
buf = bt_hci_cmd_create(op_code, data_length);
174+
buf = bt_hci_cmd_alloc(K_FOREVER);
176175
if (buf == NULL) {
177176
LOG_ERR("Unable to allocate command buffer");
178177
return err;

drivers/bluetooth/hci/hci_ifx_cyw208xx.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ static int cyw208xx_bt_firmware_download(const uint8_t *firmware_image, uint32_t
146146
}
147147

148148
/* Allocate buffer for hci_write_ram/hci_launch_ram command. */
149-
buf = bt_hci_cmd_create(op_code, data_length);
149+
buf = bt_hci_cmd_alloc(K_FOREVER);
150150
if (buf == NULL) {
151151
LOG_ERR("Unable to allocate command buffer");
152152
return -ENOBUFS;
@@ -211,7 +211,7 @@ static int cyw208xx_setup(const struct device *dev, const struct bt_hci_setup_pa
211211
cybt_platform_hci_wait_for_boot_fully_up(false);
212212

213213
/* Set public address */
214-
buf = bt_hci_cmd_create(BT_HCI_VND_OP_SET_LOCAL_DEV_ADDR, BTM_SET_LOCAL_DEV_ADDR_LENGTH);
214+
buf = bt_hci_cmd_alloc(K_FOREVER);
215215
if (buf == NULL) {
216216
LOG_ERR("Unable to allocate command buffer");
217217
cyhal_syspm_unlock_deepsleep();
@@ -375,7 +375,7 @@ wiced_bt_dev_vendor_specific_command(uint16_t opcode, uint8_t param_len, uint8_t
375375
struct net_buf *buf = NULL;
376376

377377
/* Allocate a HCI command buffer */
378-
buf = bt_hci_cmd_create(opcode, param_len);
378+
buf = bt_hci_cmd_alloc(K_FOREVER);
379379
if (!buf) {
380380
LOG_ERR("Unable to allocate buffer");
381381
return WICED_NO_MEMORY;

drivers/bluetooth/hci/hci_ifx_psoc6_bless.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ static int psoc6_bless_setup(const struct device *dev, const struct bt_hci_setup
203203
addr[5], addr[4], addr[3], addr[2], addr[1], addr[0], BT_ADDR_LE_PUBLIC,
204204
};
205205

206-
buf = bt_hci_cmd_create(PSOC6_BLESS_OP_SET_PUBLIC_ADDR, sizeof(hci_data));
206+
buf = bt_hci_cmd_alloc(K_FOREVER);
207207
if (buf == NULL) {
208208
LOG_ERR("Unable to allocate command buffer");
209209
return -ENOMEM;

drivers/bluetooth/hci/hci_nxp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static int nxp_bt_send_vs_command(uint16_t opcode, const uint8_t *params, uint8_
9494
struct net_buf *buf;
9595

9696
/* Allocate buffer for the hci command */
97-
buf = bt_hci_cmd_create(opcode, params_len);
97+
buf = bt_hci_cmd_alloc(K_FOREVER);
9898
if (buf == NULL) {
9999
LOG_ERR("Unable to allocate command buffer");
100100
return -ENOMEM;

drivers/bluetooth/hci/hci_nxp_setup.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,7 +1281,7 @@ static int bt_nxp_set_calibration_data_annex55(void)
12811281
if (IS_ENABLED(CONFIG_BT_HCI_HOST)) {
12821282
struct net_buf *buf;
12831283

1284-
buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_LENGTH);
1284+
buf = bt_hci_cmd_alloc(K_FOREVER);
12851285
if (buf == NULL) {
12861286
LOG_ERR("Unable to allocate command buffer");
12871287
return -ENOMEM;
@@ -1346,7 +1346,7 @@ static int bt_nxp_set_calibration_data_annex100(void)
13461346
if (IS_ENABLED(CONFIG_BT_HCI_HOST)) {
13471347
struct net_buf *buf;
13481348

1349-
buf = bt_hci_cmd_create(opcode, HCI_CMD_STORE_BT_CAL_DATA_PARAM_ANNEX100_LENGTH);
1349+
buf = bt_hci_cmd_alloc(K_FOREVER);
13501350
if (buf == NULL) {
13511351
LOG_ERR("Unable to allocate command buffer");
13521352
return -ENOMEM;
@@ -1387,8 +1387,7 @@ static int bt_hci_baudrate_update(const struct device *dev, uint32_t baudrate)
13871387
int err;
13881388
struct net_buf *buf;
13891389

1390-
buf = bt_hci_cmd_create(BT_HCI_VSC_BAUDRATE_UPDATE_OPCODE,
1391-
BT_HCI_VSC_BAUDRATE_UPDATE_LENGTH);
1390+
buf = bt_hci_cmd_alloc(K_FOREVER);
13921391
if (!buf) {
13931392
LOG_ERR("Fail to allocate buffer");
13941393
return -ENOBUFS;

drivers/bluetooth/hci/hci_spi_st.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static int bt_spi_send_aci_config(uint8_t offset, const uint8_t *value, size_t v
335335
hdr.param_len = data_len;
336336
buf = bt_buf_get_tx(BT_BUF_CMD, K_NO_WAIT, &hdr, sizeof(hdr));
337337
#else
338-
buf = bt_hci_cmd_create(BLUENRG_ACI_WRITE_CONFIG_DATA, data_len);
338+
buf = bt_hci_cmd_alloc(K_FOREVER);
339339
#endif /* CONFIG_BT_HCI_RAW */
340340

341341
if (!buf) {

drivers/bluetooth/hci/hci_stm32wba.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ static int bt_hci_stm32wba_setup(const struct device *dev,
432432
return -ENOMSG;
433433
}
434434

435-
buf = bt_hci_cmd_create(ACI_HAL_WRITE_CONFIG_DATA, sizeof(*param));
435+
buf = bt_hci_cmd_alloc(K_FOREVER);
436436
if (!buf) {
437437
return -ENOBUFS;
438438
}

drivers/bluetooth/hci/ipm_stm32wb.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -433,8 +433,7 @@ static int bt_ipm_set_addr(void)
433433
return -ENOMSG;
434434
}
435435

436-
buf = bt_hci_cmd_create(ACI_HAL_WRITE_CONFIG_DATA, sizeof(*param));
437-
436+
buf = bt_hci_cmd_alloc(K_FOREVER);
438437
if (!buf) {
439438
return -ENOBUFS;
440439
}
@@ -468,7 +467,7 @@ static int bt_ipm_ble_init(void)
468467
LOG_ERR("Can't set BLE UID addr");
469468
}
470469
/* Send ACI_WRITE_SET_TX_POWER_LEVEL */
471-
buf = bt_hci_cmd_create(ACI_WRITE_SET_TX_POWER_LEVEL, 3);
470+
buf = bt_hci_cmd_alloc(K_FOREVER);
472471
if (!buf) {
473472
return -ENOBUFS;
474473
}

0 commit comments

Comments
 (0)