Skip to content

Commit

Permalink
ipc_service: Start the wq only once
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
carlocaione authored and carlescufi committed Mar 7, 2022
1 parent e6212c2 commit 4ea6fd4
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions subsys/ipc/ipc_service/backends/ipc_rpmsg_static_vrings.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 4ea6fd4

Please sign in to comment.