diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2018-07-07 21:58:04 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-11-29 19:31:17 -0800 |
commit | 6d6378b8d0f9a08eee75dfb794b5697cdcd4b821 (patch) | |
tree | 48f5e4d2e4362b50570574a9d544516a12cf2c26 /common/motion_sense.c | |
parent | eef88764d241f42d27eabf64deb6f95233495adb (diff) | |
download | chrome-ec-6d6378b8d0f9a08eee75dfb794b5697cdcd4b821.tar.gz |
motion_sense: Remove global fifo_flush_needed, redundantstabilize-octopus-11316.38.Bstabilize-octopus-11316.37.Bstabilize-11316.37.Bstabilize-11316.35.B
Instead, use the event flag.
BUG=b:73557414
BRANCH=scarlet,poppy
TEST=Compile.
Change-Id: Ic1b123edb6f67012f38b1022d492492175b5d59d
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1128551
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Alexandru M Stan <amstan@chromium.org>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r-- | common/motion_sense.c | 11 |
1 files 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 |