net: openthread: Fix tasklet error printed on boot

OpenThread tries to signal pending tasklets during initialization, which
currently generate an error, as the work queue configured to handle
tasklets is initialized later. This is not a fatal issue, as the
initialization code on the Zephyr side triggers a work item immediately
after the work queue was initialized, but it doesn't look good to have
errors printed on boot.

Therefore, move the work queue initialization before the OpenThread
stack initialization, so that tasklets triggered from OT side can be
signalled properly w/o an error.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2025-06-05 15:55:46 +02:00 committed by Dan Kalowsky
commit c63ca134c6

View file

@ -295,6 +295,11 @@ int openthread_init(void)
return 0; return 0;
} }
/* Start work queue for the OpenThread module */
k_work_queue_start(&openthread_work_q, ot_stack_area,
K_KERNEL_STACK_SIZEOF(ot_stack_area),
OT_PRIORITY, &q_cfg);
openthread_mutex_lock(); openthread_mutex_lock();
otSysInit(0, NULL); otSysInit(0, NULL);
@ -342,10 +347,6 @@ int openthread_init(void)
openthread_mutex_unlock(); openthread_mutex_unlock();
/* Start work queue for the OpenThread module */
k_work_queue_start(&openthread_work_q, ot_stack_area, K_KERNEL_STACK_SIZEOF(ot_stack_area),
OT_PRIORITY, &q_cfg);
(void)k_work_submit_to_queue(&openthread_work_q, &openthread_work); (void)k_work_submit_to_queue(&openthread_work_q, &openthread_work);
return error == OT_ERROR_NONE ? 0 : -EIO; return error == OT_ERROR_NONE ? 0 : -EIO;