drivers: ethernet: 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:32:23 +02:00 committed by Carles Cufí
parent 9247f0e07b
commit fbef0edb99
5 changed files with 30 additions and 10 deletions

View File

@ -264,8 +264,12 @@ static inline void adin2111_port_on_phyint(const struct device *dev)
}
}
static void adin2111_offload_thread(const struct device *dev)
static void adin2111_offload_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p2);
ARG_UNUSED(p3);
const struct device *dev = p1;
struct adin2111_data *ctx = dev->data;
const struct adin2111_config *adin_cfg = dev->config;
bool is_adin2111 = (adin_cfg->id == ADIN2111_MAC);
@ -669,7 +673,7 @@ static void adin2111_port_iface_init(struct net_if *iface)
/* all ifaces are done, start INT processing */
k_thread_create(&ctx->rx_thread, ctx->rx_thread_stack,
CONFIG_ETH_ADIN2111_IRQ_THREAD_STACK_SIZE,
(k_thread_entry_t)adin2111_offload_thread,
adin2111_offload_thread,
(void *)adin, NULL, NULL,
CONFIG_ETH_ADIN2111_IRQ_THREAD_PRIO,
K_ESSENTIAL, K_NO_WAIT);

View File

@ -708,8 +708,12 @@ static int eth_enc28j60_rx(const struct device *dev, uint16_t *vlan_tag)
return 0;
}
static void eth_enc28j60_rx_thread(const struct device *dev)
static void eth_enc28j60_rx_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p2);
ARG_UNUSED(p3);
const struct device *dev = p1;
struct eth_enc28j60_runtime *context = dev->data;
uint16_t vlan_tag = NET_VLAN_TAG_UNSPEC;
uint8_t int_stat;
@ -850,7 +854,7 @@ static int eth_enc28j60_init(const struct device *dev)
/* Start interruption-poll thread */
k_thread_create(&context->thread, context->thread_stack,
CONFIG_ETH_ENC28J60_RX_THREAD_STACK_SIZE,
(k_thread_entry_t)eth_enc28j60_rx_thread,
eth_enc28j60_rx_thread,
(void *)dev, NULL, NULL,
K_PRIO_COOP(CONFIG_ETH_ENC28J60_RX_THREAD_PRIO),
0, K_NO_WAIT);

View File

@ -442,8 +442,12 @@ done:
return 0;
}
static void enc424j600_rx_thread(struct enc424j600_runtime *context)
static void enc424j600_rx_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p2);
ARG_UNUSED(p3);
struct enc424j600_runtime *context = p1;
uint16_t eir;
uint16_t estat;
uint8_t counter;
@ -767,7 +771,7 @@ static int enc424j600_init(const struct device *dev)
/* Start interruption-poll thread */
k_thread_create(&context->thread, context->thread_stack,
CONFIG_ETH_ENC424J600_RX_THREAD_STACK_SIZE,
(k_thread_entry_t)enc424j600_rx_thread,
enc424j600_rx_thread,
context, NULL, NULL,
K_PRIO_COOP(CONFIG_ETH_ENC424J600_RX_THREAD_PRIO),
0, K_NO_WAIT);

View File

@ -364,8 +364,12 @@ static int read_data(struct eth_context *ctx, int fd)
return 0;
}
static void eth_rx(struct eth_context *ctx)
static void eth_rx(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p2);
ARG_UNUSED(p3);
struct eth_context *ctx = p1;
LOG_DBG("Starting ZETH RX thread");
while (1) {
@ -391,7 +395,7 @@ static void create_rx_handler(struct eth_context *ctx)
k_thread_create(ctx->rx_thread,
ctx->rx_stack,
ctx->rx_stack_size,
(k_thread_entry_t)eth_rx,
eth_rx,
ctx, NULL, NULL, K_PRIO_COOP(14),
0, K_NO_WAIT);

View File

@ -275,8 +275,12 @@ static void w5500_rx(const struct device *dev)
w5500_command(dev, S0_CR_RECV);
}
static void w5500_thread(const struct device *dev)
static void w5500_thread(void *p1, void *p2, void *p3)
{
ARG_UNUSED(p2);
ARG_UNUSED(p3);
const struct device *dev = p1;
uint8_t ir;
struct w5500_runtime *ctx = dev->data;
const struct w5500_config *config = dev->config;
@ -557,7 +561,7 @@ static int w5500_init(const struct device *dev)
k_thread_create(&ctx->thread, ctx->thread_stack,
CONFIG_ETH_W5500_RX_THREAD_STACK_SIZE,
(k_thread_entry_t)w5500_thread,
w5500_thread,
(void *)dev, NULL, NULL,
K_PRIO_COOP(CONFIG_ETH_W5500_RX_THREAD_PRIO),
0, K_NO_WAIT);