From a16d5131626497a265c40ec2c3dfabd7c47af602 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 19 Jun 2019 08:57:28 +0300 Subject: [PATCH] Bluetooth: Remove unnecessary HCI command data array This array was created because more than 4 bytes were needed, however now the minimum is 8 bytes, so we can use the net_buf user data directly. Signed-off-by: Johan Hedberg --- subsys/bluetooth/host/hci_core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index c2209018ccbeb9..779363f9219d26 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -101,6 +101,9 @@ static size_t discovery_results_count; #endif /* CONFIG_BT_BREDR */ struct cmd_data { + /** BT_BUF_CMD */ + u8_t type; + /** HCI status of the command completion */ u8_t status; @@ -122,9 +125,7 @@ struct acl_data { u16_t handle; }; -static struct cmd_data cmd_data[CONFIG_BT_HCI_CMD_COUNT]; - -#define cmd(buf) (&cmd_data[net_buf_id(buf)]) +#define cmd(buf) ((struct cmd_data *)net_buf_user_data(buf)) #define acl(buf) ((struct acl_data *)net_buf_user_data(buf)) /* HCI command buffers. Derive the needed size from BT_BUF_RX_SIZE since @@ -246,8 +247,7 @@ struct net_buf *bt_hci_cmd_create(u16_t opcode, u8_t param_len) net_buf_reserve(buf, CONFIG_BT_HCI_RESERVE); - bt_buf_set_type(buf, BT_BUF_CMD); - + cmd(buf)->type = BT_BUF_CMD; cmd(buf)->opcode = opcode; cmd(buf)->sync = NULL;