summaryrefslogtreecommitdiff
path: root/driver/als_si114x.c
diff options
context:
space:
mode:
authorYuval Peress <peress@chromium.org>2019-07-15 14:10:11 -0600
committerCommit Bot <commit-bot@chromium.org>2019-09-03 20:36:04 +0000
commitdfbc632cd5b5a856086249253a98bc83d8942a29 (patch)
tree9f0359115a96ca0efe66905b5f6b1be644367430 /driver/als_si114x.c
parent083788ac19505f07bfe57a4d8b54a3b11b7554b3 (diff)
downloadchrome-ec-dfbc632cd5b5a856086249253a98bc83d8942a29.tar.gz
config: Refactor CONFIG_ACCEL_FIFO to enable use of IS_ENABLED
This change allows us to use the IS_ENABLED condition to replace the various ifdef guards around the CONFIG_ACCEL_FIFO BUG=b:137758297,chromium:981990 BRANCH=None TEST=buildall and CTS tests on Arcada Change-Id: I65d36bac19855e51c830a33e6f3812575e8d15d9 Signed-off-by: Yuval Peress <peress@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704164 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Diffstat (limited to 'driver/als_si114x.c')
-rw-r--r--driver/als_si114x.c38
1 files changed, 18 insertions, 20 deletions
diff --git a/driver/als_si114x.c b/driver/als_si114x.c
index 4db3fcc9d7..35405bbea7 100644
--- a/driver/als_si114x.c
+++ b/driver/als_si114x.c
@@ -93,9 +93,6 @@ static int si114x_read_results(struct motion_sensor_t *s, int nb)
int i, ret, val;
struct si114x_drv_data_t *data = SI114X_GET_DATA(s);
struct si114x_typed_data_t *type_data = SI114X_GET_TYPED_DATA(s);
-#ifdef CONFIG_ACCEL_FIFO
- struct ec_response_motion_sensor_data vector;
-#endif
/* Read ALX result */
for (i = 0; i < nb; i++) {
@@ -147,23 +144,24 @@ static int si114x_read_results(struct motion_sensor_t *s, int nb)
if (i == nb)
return EC_ERROR_UNCHANGED;
-#ifdef CONFIG_ACCEL_FIFO
- vector.flags = 0;
- for (i = 0; i < nb; i++)
- vector.data[i] = s->raw_xyz[i];
- for (i = nb; i < 3; i++)
- vector.data[i] = 0;
- vector.sensor_num = s - motion_sensors;
- motion_sense_fifo_stage_data(&vector, s, nb,
- __hw_clock_source_read());
- motion_sense_fifo_commit_data();
- /*
- * TODO: get time at a more accurate spot.
- * Like in si114x_interrupt
- */
-#else
- /* We need to copy raw_xyz into xyz with mutex */
-#endif
+ if (IS_ENABLED(CONFIG_ACCEL_FIFO)) {
+ struct ec_response_motion_sensor_data vector;
+
+ vector.flags = 0;
+ for (i = 0; i < nb; i++)
+ vector.data[i] = s->raw_xyz[i];
+ for (i = nb; i < 3; i++)
+ vector.data[i] = 0;
+ vector.sensor_num = s - motion_sensors;
+ motion_sense_fifo_stage_data(&vector, s, nb,
+ __hw_clock_source_read());
+ motion_sense_fifo_commit_data();
+ /*
+ * TODO: get time at a more accurate spot.
+ * Like in si114x_interrupt
+ */
+ }
+ /* Otherwise, we need to copy raw_xyz into xyz with mutex */
return EC_SUCCESS;
}