ipc_service: Start the wq only once

No need to start the wq every time the mbox is initialized, it must be
done once for all the instances (it is shared by all the instances).

Signed-off-by: Carlo Caione <ccaione@baylibre.com>
This commit is contained in:
Carlo Caione 2022-03-02 11:12:29 +01:00 committed by Carles Cufí
commit 4ea6fd4f20

View file

@ -271,9 +271,6 @@ static int mbox_init(const struct device *instance)
struct backend_data_t *data = instance->data;
int err;
k_work_queue_start(&mbox_wq, mbox_stack, K_KERNEL_STACK_SIZEOF(mbox_stack),
WQ_PRIORITY, NULL);
k_work_init(&data->mbox_work, mbox_callback_process);
err = mbox_register_callback(&conf->mbox_rx, mbox_callback, data);
@ -471,12 +468,19 @@ static int backend_init(const struct device *instance)
{
const struct backend_config_t *conf = instance->config;
struct backend_data_t *data = instance->data;
static bool wq_started;
data->role = conf->role;
k_mutex_init(&data->rpmsg_inst.mtx);
atomic_set(&data->state, STATE_READY);
if (!wq_started) {
k_work_queue_start(&mbox_wq, mbox_stack, K_KERNEL_STACK_SIZEOF(mbox_stack),
WQ_PRIORITY, NULL);
wq_started = true;
}
return 0;
}