kernel: Fix bug in dynamic alert initialization
k_alert_init() needs to set the "flags" field of its associated work item to zero, indicating that the work item has not yet been submitted to the system workqueue. Using the standard work item initializer macro ensures this is done correctly. Change-Id: I0001a5920f20fb1d8dc182191e6a549c5bf89be5 Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
This commit is contained in:
parent
dd6f9ca9de
commit
3cd702010f
1 changed files with 1 additions and 5 deletions
|
@ -74,13 +74,9 @@ void _alert_deliver(struct k_work *work)
|
|||
void k_alert_init(struct k_alert *alert, k_alert_handler_t handler,
|
||||
unsigned int max_num_pending_alerts)
|
||||
{
|
||||
const struct k_work my_work_item = {
|
||||
NULL, _alert_deliver, { max_num_pending_alerts }
|
||||
};
|
||||
|
||||
alert->handler = handler;
|
||||
alert->send_count = ATOMIC_INIT(0);
|
||||
alert->work_item = my_work_item;
|
||||
alert->work_item = (struct k_work)K_WORK_INITIALIZER(_alert_deliver);
|
||||
k_sem_init(&alert->sem, 0, max_num_pending_alerts);
|
||||
SYS_TRACING_OBJ_INIT(k_alert, alert);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue