From 6d6378b8d0f9a08eee75dfb794b5697cdcd4b821 Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Sat, 7 Jul 2018 21:58:04 -0700 Subject: motion_sense: Remove global fifo_flush_needed, redundant Instead, use the event flag. BUG=b:73557414 BRANCH=scarlet,poppy TEST=Compile. Change-Id: Ic1b123edb6f67012f38b1022d492492175b5d59d Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/1128551 Commit-Ready: ChromeOS CL Exonerator Bot Reviewed-by: Alexandru M Stan --- common/motion_sense.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/common/motion_sense.c b/common/motion_sense.c index e5afb3e142..c4c380629b 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -93,8 +93,6 @@ static void print_spoof_mode_status(int id); /* Need to wake up the AP */ static int wake_up_needed; -/* Need to send flush events */ -static int fifo_flush_needed; /* Number of element the AP should collect */ static int fifo_queue_count; static int fifo_int_enabled; @@ -750,7 +748,6 @@ static int motion_sense_process(struct motion_sensor_t *sensor, int flush_pending; flush_pending = atomic_read_clear(&sensor->flush_pending); for (; flush_pending > 0; flush_pending--) { - fifo_flush_needed = 1; motion_sense_insert_flush(sensor); } } @@ -976,16 +973,16 @@ void motion_sense_task(void *u) * - the queue is almost full, * - we haven't done it for a while. */ - if (fifo_flush_needed || wake_up_needed || - event & TASK_EVENT_MOTION_ODR_CHANGE || + if (wake_up_needed || + event & (TASK_EVENT_MOTION_ODR_CHANGE | + TASK_EVENT_MOTION_FLUSH_PENDING) || queue_space(&motion_sense_fifo) < CONFIG_ACCEL_FIFO_THRES || (motion_int_interval > 0 && time_after(ts_end_task.le.lo, ts_last_int.le.lo + motion_int_interval))) { - if (!fifo_flush_needed) + if ((event & TASK_EVENT_MOTION_FLUSH_PENDING) == 0) motion_sense_insert_timestamp( __hw_clock_source_read()); - fifo_flush_needed = 0; ts_last_int = ts_end_task; /* * Count the number of event the AP is allowed to -- cgit v1.2.1