From 7a87dae5c7208f7f4264ea89fa10ba37322e838a Mon Sep 17 00:00:00 2001 From: Alec Berg Date: Thu, 17 Sep 2015 14:30:32 -0700 Subject: [PATCH] motion: fix task to guarantee task never exits Fix motion_sense task to make sure the task never exits. Note, before this change a task_wake(TASK_ID_MOTIONSENSE) would end the task because task_wait_event() would return 0. BUG=none BRANCH=smaug TEST=with following CL, run motion_lid test and make sure it passes Change-Id: I67bd2e535d67215baa0cc1dfd0010b8199152dbd Signed-off-by: Alec Berg Reviewed-on: https://chromium-review.googlesource.com/300630 Commit-Ready: Gwendal Grignou Tested-by: Gwendal Grignou Reviewed-by: Gwendal Grignou --- common/motion_sense.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/common/motion_sense.c b/common/motion_sense.c index fdc36cd134..bea0bef1cf 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -539,7 +539,7 @@ void motion_sense_task(void) #ifdef CONFIG_ACCEL_FIFO ts_last_int = get_time(); #endif - do { + while (1) { ts_begin_task = get_time(); ready_status = 0; for (i = 0; i < motion_sensor_count; ++i) { @@ -641,7 +641,8 @@ void motion_sense_task(void) wait_us = -1; } - } while ((event = task_wait_event(wait_us))); + event = task_wait_event(wait_us); + } } #ifdef CONFIG_ACCEL_FIFO