drivers: bluetooth: fix thread function signatures

Fix thread function signatures to avoid a stack corruption on thread exit.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
This commit is contained in:
Benedikt Schmidt 2023-09-21 09:29:41 +02:00 committed by Carles Cufí
parent c533924370
commit 9247f0e07b
4 changed files with 34 additions and 9 deletions

View File

@ -607,8 +607,12 @@ static int h5_queue(struct net_buf *buf)
return 0;
}
static void tx_thread(void)
static void tx_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
LOG_DBG("");
/* FIXME: make periodic sending */
@ -653,8 +657,12 @@ static void h5_set_txwin(uint8_t *conf)
conf[2] = h5.tx_win & 0x07;
}
static void rx_thread(void)
static void rx_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
LOG_DBG("");
while (true) {
@ -721,7 +729,7 @@ static void h5_init(void)
k_fifo_init(&h5.tx_queue);
k_thread_create(&tx_thread_data, tx_stack,
K_KERNEL_STACK_SIZEOF(tx_stack),
(k_thread_entry_t)tx_thread, NULL, NULL, NULL,
tx_thread, NULL, NULL, NULL,
K_PRIO_COOP(CONFIG_BT_HCI_TX_PRIO),
0, K_NO_WAIT);
k_thread_name_set(&tx_thread_data, "tx_thread");
@ -729,7 +737,7 @@ static void h5_init(void)
k_fifo_init(&h5.rx_queue);
k_thread_create(&rx_thread_data, rx_stack,
K_KERNEL_STACK_SIZEOF(rx_stack),
(k_thread_entry_t)rx_thread, NULL, NULL, NULL,
rx_thread, NULL, NULL, NULL,
K_PRIO_COOP(CONFIG_BT_RX_PRIO),
0, K_NO_WAIT);
k_thread_name_set(&rx_thread_data, "rx_thread");

View File

@ -159,8 +159,12 @@ void TM_EvtReceivedCb(TL_EvtPacket_t *hcievt)
k_fifo_put(&ipm_rx_events_fifo, hcievt);
}
static void bt_ipm_rx_thread(void)
static void bt_ipm_rx_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
while (true) {
bool discardable = false;
k_timeout_t timeout = K_FOREVER;
@ -554,7 +558,7 @@ static int bt_ipm_open(void)
/* Start RX thread */
k_thread_create(&ipm_rx_thread_data, ipm_rx_stack,
K_KERNEL_STACK_SIZEOF(ipm_rx_stack),
(k_thread_entry_t)bt_ipm_rx_thread, NULL, NULL, NULL,
bt_ipm_rx_thread, NULL, NULL, NULL,
K_PRIO_COOP(CONFIG_BT_DRIVER_RX_HIGH_PRIO),
0, K_NO_WAIT);

View File

@ -117,6 +117,15 @@ done:
return rv;
}
static void slz_thread_func(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
slz_ll_thread_func();
}
static int slz_bt_open(void)
{
int ret;
@ -124,7 +133,7 @@ static int slz_bt_open(void)
/* Start RX thread */
k_thread_create(&slz_ll_thread, slz_ll_stack,
K_KERNEL_STACK_SIZEOF(slz_ll_stack),
(k_thread_entry_t)slz_ll_thread_func, NULL, NULL, NULL,
slz_thread_func, NULL, NULL, NULL,
K_PRIO_COOP(CONFIG_BT_DRIVER_RX_HIGH_PRIO), 0,
K_NO_WAIT);

View File

@ -344,8 +344,12 @@ static struct net_buf *bt_spi_rx_buf_construct(uint8_t *msg)
return buf;
}
static void bt_spi_rx_thread(void)
static void bt_spi_rx_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
uint8_t header_master[5] = { SPI_READ, 0x00, 0x00, 0x00, 0x00 };
uint8_t header_slave[5];
struct net_buf *buf;
@ -528,7 +532,7 @@ static int bt_spi_open(void)
/* Start RX thread */
k_thread_create(&spi_rx_thread_data, spi_rx_stack,
K_KERNEL_STACK_SIZEOF(spi_rx_stack),
(k_thread_entry_t)bt_spi_rx_thread, NULL, NULL, NULL,
bt_spi_rx_thread, NULL, NULL, NULL,
K_PRIO_COOP(CONFIG_BT_DRIVER_RX_HIGH_PRIO),
0, K_NO_WAIT);