Skip to content

Commit 66e7332

Browse files
committed
Bluetooth: Host: Remove syswq workaround in bt_hci_cmd_send_sync()
Now that tx_processor is in bt_taskq, we don't need special handling for when it runs on the syswq. Signed-off-by: Aleksander Wasaznik <[email protected]>
1 parent 4b57af4 commit 66e7332

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

subsys/bluetooth/host/hci_core.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -471,35 +471,6 @@ int bt_hci_cmd_send_sync(uint16_t opcode, struct net_buf *buf,
471471
return err;
472472
}
473473

474-
/* TODO: disallow sending sync commands from syswq altogether */
475-
476-
/* Since the commands are now processed in the syswq, we cannot suspend
477-
* and wait. We have to send the command from the current context.
478-
*/
479-
if (k_current_get() == &k_sys_work_q.thread) {
480-
/* drain the command queue until we get to send the command of interest. */
481-
struct net_buf *cmd = NULL;
482-
483-
do {
484-
cmd = k_fifo_peek_head(&bt_dev.cmd_tx_queue);
485-
LOG_DBG("process cmd %p want %p", cmd, buf);
486-
487-
/* Wait for a response from the Bluetooth Controller.
488-
* The Controller may fail to respond if:
489-
* - It was never programmed or connected.
490-
* - There was a fatal error.
491-
*
492-
* See the `BT_HCI_OP_` macros in hci_types.h or
493-
* Core_v5.4, Vol 4, Part E, Section 5.4.1 and Section 7
494-
* to map the opcode to the HCI command documentation.
495-
* Example: 0x0c03 represents HCI_Reset command.
496-
*/
497-
__maybe_unused bool success = process_pending_cmd(HCI_CMD_TIMEOUT);
498-
499-
BT_ASSERT_MSG(success, "command opcode 0x%04x timeout", opcode);
500-
} while (buf != cmd);
501-
}
502-
503474
/* Now that we have sent the command, suspend until the LL replies */
504475
err = k_sem_take(&sync_sem, HCI_CMD_TIMEOUT);
505476
BT_ASSERT_MSG(err == 0,

0 commit comments

Comments
 (0)