usb: 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:
parent
c5b252d8f1
commit
be8408cbac
|
@ -122,8 +122,12 @@ static struct usb_ep_cfg_data bluetooth_ep_data[] = {
|
|||
},
|
||||
};
|
||||
|
||||
static void hci_tx_thread(void)
|
||||
static void hci_tx_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
LOG_DBG("Start USB Bluetooth thread");
|
||||
|
||||
while (true) {
|
||||
|
@ -174,8 +178,12 @@ static void hci_tx_thread(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void hci_rx_thread(void)
|
||||
static void hci_rx_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
while (true) {
|
||||
struct net_buf *buf;
|
||||
int err;
|
||||
|
@ -467,14 +475,14 @@ static int bluetooth_init(void)
|
|||
|
||||
k_thread_create(&rx_thread_data, rx_thread_stack,
|
||||
K_KERNEL_STACK_SIZEOF(rx_thread_stack),
|
||||
(k_thread_entry_t)hci_rx_thread, NULL, NULL, NULL,
|
||||
hci_rx_thread, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
|
||||
k_thread_name_set(&rx_thread_data, "usb_bt_rx");
|
||||
|
||||
k_thread_create(&tx_thread_data, tx_thread_stack,
|
||||
K_KERNEL_STACK_SIZEOF(tx_thread_stack),
|
||||
(k_thread_entry_t)hci_tx_thread, NULL, NULL, NULL,
|
||||
hci_tx_thread, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
|
||||
k_thread_name_set(&tx_thread_data, "usb_bt_tx");
|
||||
|
|
|
@ -113,8 +113,12 @@ static void bt_h4_read(uint8_t ep, int size, void *priv)
|
|||
USB_MAX_FS_BULK_MPS, USB_TRANS_READ, bt_h4_read, NULL);
|
||||
}
|
||||
|
||||
static void hci_tx_thread(void)
|
||||
static void hci_tx_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
LOG_DBG("Start USB Bluetooth thread");
|
||||
|
||||
while (true) {
|
||||
|
@ -129,8 +133,12 @@ static void hci_tx_thread(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void hci_rx_thread(void)
|
||||
static void hci_rx_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
while (true) {
|
||||
struct net_buf *buf;
|
||||
|
||||
|
@ -235,14 +243,14 @@ static int bt_h4_init(void)
|
|||
|
||||
k_thread_create(&rx_thread_data, rx_thread_stack,
|
||||
K_KERNEL_STACK_SIZEOF(rx_thread_stack),
|
||||
(k_thread_entry_t)hci_rx_thread, NULL, NULL, NULL,
|
||||
hci_rx_thread, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
|
||||
k_thread_name_set(&rx_thread_data, "usb_bt_h4_rx");
|
||||
|
||||
k_thread_create(&tx_thread_data, tx_thread_stack,
|
||||
K_KERNEL_STACK_SIZEOF(tx_thread_stack),
|
||||
(k_thread_entry_t)hci_tx_thread, NULL, NULL, NULL,
|
||||
hci_tx_thread, NULL, NULL, NULL,
|
||||
K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
|
||||
k_thread_name_set(&tx_thread_data, "usb_bt_h4_tx");
|
||||
|
|
|
@ -972,10 +972,11 @@ USBD_DEFINE_CFG_DATA(mass_storage_config) = {
|
|||
.endpoint = mass_ep_data
|
||||
};
|
||||
|
||||
static void mass_thread_main(int arg1, int unused)
|
||||
static void mass_thread_main(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(unused);
|
||||
ARG_UNUSED(arg1);
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
while (1) {
|
||||
k_sem_take(&disk_wait_sem, K_FOREVER);
|
||||
|
@ -1057,7 +1058,7 @@ static int mass_storage_init(void)
|
|||
/* Start a thread to offload disk ops */
|
||||
k_thread_create(&mass_thread_data, mass_thread_stack,
|
||||
CONFIG_MASS_STORAGE_STACK_SIZE,
|
||||
(k_thread_entry_t)mass_thread_main, NULL, NULL, NULL,
|
||||
mass_thread_main, NULL, NULL, NULL,
|
||||
DISK_THREAD_PRIO, 0, K_NO_WAIT);
|
||||
|
||||
k_thread_name_set(&mass_thread_data, "usb_mass");
|
||||
|
|
|
@ -883,8 +883,12 @@ static int rndis_class_handler(struct usb_setup_packet *setup, int32_t *len,
|
|||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
static void cmd_thread(void)
|
||||
static void cmd_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
LOG_INF("Command thread started");
|
||||
|
||||
while (true) {
|
||||
|
@ -1051,7 +1055,7 @@ static int rndis_init(void)
|
|||
|
||||
k_thread_create(&cmd_thread_data, cmd_stack,
|
||||
K_KERNEL_STACK_SIZEOF(cmd_stack),
|
||||
(k_thread_entry_t)cmd_thread,
|
||||
cmd_thread,
|
||||
NULL, NULL, NULL, K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
|
||||
k_thread_name_set(&cmd_thread_data, "usb_rndis");
|
||||
|
|
|
@ -163,8 +163,12 @@ static ALWAYS_INLINE int usbd_event_handler(struct usbd_contex *const uds_ctx,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void usbd_thread(void)
|
||||
static void usbd_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct udc_event event;
|
||||
|
||||
while (true) {
|
||||
|
@ -226,7 +230,7 @@ static int usbd_pre_init(void)
|
|||
{
|
||||
k_thread_create(&usbd_thread_data, usbd_stack,
|
||||
K_KERNEL_STACK_SIZEOF(usbd_stack),
|
||||
(k_thread_entry_t)usbd_thread,
|
||||
usbd_thread,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_COOP(8), 0, K_NO_WAIT);
|
||||
|
||||
|
|
|
@ -90,8 +90,12 @@ static ALWAYS_INLINE int usbh_event_handler(struct usbh_contex *const ctx,
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void usbh_thread(const struct device *dev)
|
||||
static void usbh_thread(void *p1, void *p2, void *p3)
|
||||
{
|
||||
ARG_UNUSED(p1);
|
||||
ARG_UNUSED(p2);
|
||||
ARG_UNUSED(p3);
|
||||
|
||||
struct uhc_event event;
|
||||
|
||||
while (true) {
|
||||
|
@ -130,7 +134,7 @@ static int uhs_pre_init(void)
|
|||
{
|
||||
k_thread_create(&usbh_thread_data, usbh_stack,
|
||||
K_KERNEL_STACK_SIZEOF(usbh_stack),
|
||||
(k_thread_entry_t)usbh_thread,
|
||||
usbh_thread,
|
||||
NULL, NULL, NULL,
|
||||
K_PRIO_COOP(9), 0, K_NO_WAIT);
|
||||
|
||||
|
|
Loading…
Reference in a new issue