Bluetooth: Add dedicated bt_send() function
This helps avoid digging out the driver and send callback pointers, and helps prepare for extended logging support to export the HCI traffic externally. Change-Id: I1a9a58a6b47babed41b5bb9349635478905352e1 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
b628aa8a87
commit
5cec79e4c8
3 changed files with 12 additions and 6 deletions
|
@ -862,8 +862,7 @@ static bool send_frag(struct bt_conn *conn, struct net_buf *buf, uint8_t flags,
|
|||
|
||||
bt_buf_set_type(buf, BT_BUF_ACL_OUT);
|
||||
|
||||
BT_DBG("passing buf %p len %u to driver", buf, buf->len);
|
||||
err = bt_dev.drv->send(buf);
|
||||
err = bt_send(buf);
|
||||
if (err) {
|
||||
BT_ERR("Unable to send to driver (err %d)", err);
|
||||
goto fail;
|
||||
|
|
|
@ -225,7 +225,7 @@ int bt_hci_cmd_send(uint16_t opcode, struct net_buf *buf)
|
|||
if (opcode == BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS) {
|
||||
int err;
|
||||
|
||||
err = bt_dev.drv->send(buf);
|
||||
err = bt_send(buf);
|
||||
if (err) {
|
||||
BT_ERR("Unable to send to driver (err %d)", err);
|
||||
net_buf_unref(buf);
|
||||
|
@ -2552,8 +2552,6 @@ static void hci_event(struct net_buf *buf)
|
|||
|
||||
static void hci_cmd_tx_fiber(void)
|
||||
{
|
||||
struct bt_driver *drv = bt_dev.drv;
|
||||
|
||||
BT_DBG("started");
|
||||
|
||||
while (1) {
|
||||
|
@ -2581,7 +2579,7 @@ static void hci_cmd_tx_fiber(void)
|
|||
BT_DBG("Sending command 0x%04x (buf %p) to driver",
|
||||
cmd(buf)->opcode, buf);
|
||||
|
||||
err = drv->send(buf);
|
||||
err = bt_send(buf);
|
||||
if (err) {
|
||||
BT_ERR("Unable to send to driver (err %d)", err);
|
||||
nano_fiber_sem_give(&bt_dev.ncmd_sem);
|
||||
|
@ -3133,6 +3131,13 @@ static int hci_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int bt_send(struct net_buf *buf)
|
||||
{
|
||||
BT_DBG("buf %p len %u type %u", buf, buf->len, bt_buf_get_type(buf));
|
||||
|
||||
return bt_dev.drv->send(buf);
|
||||
}
|
||||
|
||||
/* Interface to HCI driver layer */
|
||||
|
||||
int bt_recv(struct net_buf *buf)
|
||||
|
|
|
@ -184,3 +184,5 @@ int bt_rand(void *buf, size_t len);
|
|||
int bt_le_scan_update(bool fast_scan);
|
||||
|
||||
bool bt_addr_le_is_bonded(const bt_addr_le_t *addr);
|
||||
|
||||
int bt_send(struct net_buf *buf);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue