summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Honscheid <honscheid@google.com>2021-11-04 14:11:43 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-09 21:29:41 +0000
commitf5a499d68ff0c25b1ef354d27de62c6df1a72681 (patch)
treea49ed41cfc307bf871244e1b80cc73f70b21cdf2
parent4b232a413863ca58ebe8a123e68a78031004a464 (diff)
downloadchrome-ec-f5a499d68ff0c25b1ef354d27de62c6df1a72681.tar.gz
zephyr: bmi160: Remove redundant check from config_interrupt
We check twice that the sensor being passed in to `config_accel_interrupt()` is an accelerometer. This is unnecessary and creates unreachable code. BRANCH=None BUG=b:184856157 TEST=zmake -D configure --test test-drivers; make runhosttests Signed-off-by: Tristan Honscheid <honscheid@google.com> Change-Id: Ic07bfe76ae20e1615bcf52717a106cc622d32d84 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3262106 Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r--driver/accelgyro_bmi160.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index 9983f4648c..ebcb6f71dc 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -394,13 +394,12 @@ static int manage_activity(const struct motion_sensor_t *s,
}
#endif
-static __maybe_unused int config_interrupt(const struct motion_sensor_t *s)
+/** Requires that the passed sensor `*s` is an accelerometer */
+static __maybe_unused int
+config_accel_interrupt(const struct motion_sensor_t *s)
{
int ret, tmp;
- if (s->type != MOTIONSENSE_TYPE_ACCEL)
- return EC_SUCCESS;
-
mutex_lock(s->mutex);
bmi_write8(s->port, s->i2c_spi_addr_flags,
BMI160_CMD_REG, BMI160_CMD_FIFO_FLUSH);
@@ -735,7 +734,7 @@ static int init(struct motion_sensor_t *s)
if (IS_ENABLED(CONFIG_ACCEL_INTERRUPTS) &&
(s->type == MOTIONSENSE_TYPE_ACCEL))
- ret = config_interrupt(s);
+ ret = config_accel_interrupt(s);
return sensor_init_done(s);
}