summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Short <keithshort@chromium.org>2019-12-11 17:05:59 -0700
committerCommit Bot <commit-bot@chromium.org>2019-12-13 19:22:23 +0000
commitf97deaaa107cdc980dd5c3b84222eb27b380d48c (patch)
tree4a704c3d4be97ee425cedf902f04228b7dfca3c1
parent605277a471915129d94fdfa368dcac13d0d395aa (diff)
downloadchrome-ec-f97deaaa107cdc980dd5c3b84222eb27b380d48c.tar.gz
bma2x2: Add an assert that verifies the mutex
The BMA2x2 accelerometer driver requires that the motionsense entry defines a mutex. Add an assert to enforce the mutex. Without the assert, initializing the driver causes a watchdog timeout. BUG=b:146081107 BRANCH=none TEST=make buildall TEST=On Volteer, add BMA2x2 driver to motionsense without creating mutex, verify assert. With mutex present, driver initializes correctly. Change-Id: Id66b5dea3568a3fa31ce9e125d8176141627f241 Signed-off-by: Keith Short <keithshort@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1965645 Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--driver/accel_bma2x2.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/driver/accel_bma2x2.c b/driver/accel_bma2x2.c
index 9a63bdc1ba..a4f66036ce 100644
--- a/driver/accel_bma2x2.c
+++ b/driver/accel_bma2x2.c
@@ -256,6 +256,9 @@ static int init(const struct motion_sensor_t *s)
{
int ret = 0, tries = 0, val, reg, reset_field;
+ /* This driver requires a mutex */
+ ASSERT(s->mutex);
+
ret = raw_read8(s->port, s->i2c_spi_addr_flags,
BMA2x2_CHIP_ID_ADDR, &val);
if (ret)