summaryrefslogtreecommitdiff
path: root/common/motion_sense.c
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2021-11-05 14:24:17 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-08 23:36:07 +0000
commit687b239833af6369141afeea2f25956184d70b09 (patch)
treea113f23a847fefe5f073fc6b364f975fff145fe4 /common/motion_sense.c
parentff45017216f37d00a9588abef0a2609635f0a042 (diff)
downloadchrome-ec-687b239833af6369141afeea2f25956184d70b09.tar.gz
Task: Introduce generic deferred check
Code will currently check whether it's running in a deferred context by directly checking against TASK_ID_HOOKS. However, this should be checked in a function which can be set based on the OS running to account for OS differences. BRANCH=None BUG=b:195137794 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I54c266bb3a36ee3aa3fe6f8a09fcbfafe2fb43e9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3265285 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r--common/motion_sense.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 6a93e15dde..a9b15fd071 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -332,10 +332,10 @@ static inline int motion_sense_init(struct motion_sensor_t *sensor)
BUILD_ASSERT(SENSOR_COUNT < 32);
#if defined(HAS_TASK_CONSOLE)
- ASSERT((task_get_current() == TASK_ID_HOOKS) ||
+ ASSERT((in_deferred_context()) ||
(task_get_current() == TASK_ID_CONSOLE));
#else
- ASSERT(task_get_current() == TASK_ID_HOOKS);
+ ASSERT(in_deferred_context());
#endif /* HAS_TASK_CONSOLE */
/* Initialize accelerometers. */
@@ -386,7 +386,7 @@ static void motion_sense_switch_sensor_rate(void)
struct motion_sensor_t *sensor;
unsigned int sensor_setup_mask = 0;
- ASSERT(task_get_current() == TASK_ID_HOOKS);
+ ASSERT(in_deferred_context());
for (i = 0; i < motion_sensor_count; ++i) {
sensor = &motion_sensors[i];