drivers: modem: fix thread function signatures

Fix thread function signatures to avoid 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:37:47 +02:00 committed by Carles Cufí
parent 9eb993c063
commit ba49cb81f1
6 changed files with 36 additions and 12 deletions

View file

@ -169,8 +169,12 @@ static int modem_atoi(const char *s, const int err_value,
} }
#endif #endif
static void gsm_rx(struct gsm_modem *gsm) static void gsm_rx(void *p1, void *p2, void *p3)
{ {
ARG_UNUSED(p2);
ARG_UNUSED(p3);
struct gsm_modem *gsm = p1;
LOG_DBG("starting"); LOG_DBG("starting");
while (true) { while (true) {
@ -1323,7 +1327,7 @@ static int gsm_init(const struct device *dev)
(void)k_thread_create(&gsm->rx_thread, gsm_rx_stack, (void)k_thread_create(&gsm->rx_thread, gsm_rx_stack,
K_KERNEL_STACK_SIZEOF(gsm_rx_stack), K_KERNEL_STACK_SIZEOF(gsm_rx_stack),
(k_thread_entry_t) gsm_rx, gsm_rx,
gsm, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT); gsm, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
(void)k_thread_name_set(&gsm->rx_thread, "gsm_rx"); (void)k_thread_name_set(&gsm->rx_thread, "gsm_rx");

View file

@ -4482,8 +4482,12 @@ static void process_fw_update_rx(struct net_buf **rx_buf)
#endif /* CONFIG_MODEM_HL7800_FW_UPDATE */ #endif /* CONFIG_MODEM_HL7800_FW_UPDATE */
/* RX thread */ /* RX thread */
static void hl7800_rx(void) static void hl7800_rx(void *p1, void *p2, void *p3)
{ {
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
struct net_buf *rx_buf = NULL; struct net_buf *rx_buf = NULL;
struct net_buf *frag = NULL; struct net_buf *frag = NULL;
int i, cmp_res; int i, cmp_res;
@ -6426,7 +6430,7 @@ static int hl7800_init(const struct device *dev)
k_thread_name_set( k_thread_name_set(
k_thread_create(&hl7800_rx_thread, hl7800_rx_stack, k_thread_create(&hl7800_rx_thread, hl7800_rx_stack,
K_THREAD_STACK_SIZEOF(hl7800_rx_stack), K_THREAD_STACK_SIZEOF(hl7800_rx_stack),
(k_thread_entry_t)hl7800_rx, NULL, NULL, NULL, hl7800_rx, NULL, NULL, NULL,
RX_THREAD_PRIORITY, 0, K_NO_WAIT), RX_THREAD_PRIORITY, 0, K_NO_WAIT),
"hl7800 rx"); "hl7800 rx");

View file

@ -846,8 +846,12 @@ static ssize_t offload_sendmsg(void *obj, const struct msghdr *msg, int flags)
/* Func: modem_rx /* Func: modem_rx
* Desc: Thread to process all messages received from the Modem. * Desc: Thread to process all messages received from the Modem.
*/ */
static void modem_rx(void) static void modem_rx(void *p1, void *p2, void *p3)
{ {
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
while (true) { while (true) {
/* Wait for incoming data */ /* Wait for incoming data */
@ -1264,7 +1268,7 @@ static int modem_init(const struct device *dev)
/* start RX thread */ /* start RX thread */
k_thread_create(&modem_rx_thread, modem_rx_stack, k_thread_create(&modem_rx_thread, modem_rx_stack,
K_KERNEL_STACK_SIZEOF(modem_rx_stack), K_KERNEL_STACK_SIZEOF(modem_rx_stack),
(k_thread_entry_t) modem_rx, modem_rx,
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT); NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
/* Init RSSI query */ /* Init RSSI query */

View file

@ -802,8 +802,12 @@ static int offload_socket(int family, int type, int proto)
/* /*
* Process all messages received from the modem. * Process all messages received from the modem.
*/ */
static void modem_rx(void) static void modem_rx(void *p1, void *p2, void *p3)
{ {
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
while (true) { while (true) {
/* Wait for incoming data */ /* Wait for incoming data */
modem_iface_uart_rx_wait(&mctx.iface, K_FOREVER); modem_iface_uart_rx_wait(&mctx.iface, K_FOREVER);
@ -2414,7 +2418,7 @@ static int modem_init(const struct device *dev)
} }
k_thread_create(&modem_rx_thread, modem_rx_stack, K_KERNEL_STACK_SIZEOF(modem_rx_stack), k_thread_create(&modem_rx_thread, modem_rx_stack, K_KERNEL_STACK_SIZEOF(modem_rx_stack),
(k_thread_entry_t)modem_rx, NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT); modem_rx, NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
/* Init RSSI query */ /* Init RSSI query */
k_work_init_delayable(&mdata.rssi_query_work, modem_rssi_query_work); k_work_init_delayable(&mdata.rssi_query_work, modem_rssi_query_work);

View file

@ -936,8 +936,12 @@ MODEM_CMD_DEFINE(on_cmd_socknotifycreg)
} }
/* RX thread */ /* RX thread */
static void modem_rx(void) static void modem_rx(void *p1, void *p2, void *p3)
{ {
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
while (true) { while (true) {
/* wait for incoming data */ /* wait for incoming data */
modem_iface_uart_rx_wait(&mctx.iface, K_FOREVER); modem_iface_uart_rx_wait(&mctx.iface, K_FOREVER);
@ -2220,7 +2224,7 @@ static int modem_init(const struct device *dev)
/* start RX thread */ /* start RX thread */
k_thread_create(&modem_rx_thread, modem_rx_stack, k_thread_create(&modem_rx_thread, modem_rx_stack,
K_KERNEL_STACK_SIZEOF(modem_rx_stack), K_KERNEL_STACK_SIZEOF(modem_rx_stack),
(k_thread_entry_t) modem_rx, modem_rx,
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT); NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
#if defined(CONFIG_MODEM_UBLOX_SARA_RSSI_WORK) #if defined(CONFIG_MODEM_UBLOX_SARA_RSSI_WORK)

View file

@ -1057,8 +1057,12 @@ static void wncm14a2a_read_rx(struct net_buf **buf)
} }
/* RX thread */ /* RX thread */
static void wncm14a2a_rx(void) static void wncm14a2a_rx(void *p1, void *p2, void *p3)
{ {
ARG_UNUSED(p1);
ARG_UNUSED(p2);
ARG_UNUSED(p3);
struct net_buf *rx_buf = NULL; struct net_buf *rx_buf = NULL;
struct net_buf *frag = NULL; struct net_buf *frag = NULL;
int i; int i;
@ -1430,7 +1434,7 @@ static int wncm14a2a_init(const struct device *dev)
/* start RX thread */ /* start RX thread */
k_thread_create(&wncm14a2a_rx_thread, wncm14a2a_rx_stack, k_thread_create(&wncm14a2a_rx_thread, wncm14a2a_rx_stack,
K_KERNEL_STACK_SIZEOF(wncm14a2a_rx_stack), K_KERNEL_STACK_SIZEOF(wncm14a2a_rx_stack),
(k_thread_entry_t) wncm14a2a_rx, wncm14a2a_rx,
NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT); NULL, NULL, NULL, K_PRIO_COOP(7), 0, K_NO_WAIT);
/* init RSSI query */ /* init RSSI query */