summaryrefslogtreecommitdiff
path: root/common/i2c_controller.c
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2022-07-19 14:50:29 +0200
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-26 06:16:29 +0000
commit66a8a35253f5578a40db31686d0e11b2587f302c (patch)
treeba070f4b2e99033ca30e16c57dbd41bf2c48f79f /common/i2c_controller.c
parentdcf017cf730304bd167956eddc60879b4aa94af0 (diff)
downloadchrome-ec-66a8a35253f5578a40db31686d0e11b2587f302c.tar.gz
zephyr: test: add i2c_lock test
I2C enums and I2C devices are not the same. Add a test to verify the i2c_lock function locks the physical device correctly. BUG=b:228240586 TEST=zmake testall BRANCH=main Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I08eddcf03d80a9a5b75667b3dfcaa47469ddedf1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3773857 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
Diffstat (limited to 'common/i2c_controller.c')
-rw-r--r--common/i2c_controller.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/common/i2c_controller.c b/common/i2c_controller.c
index cc7dad9bed..e0662b9f28 100644
--- a/common/i2c_controller.c
+++ b/common/i2c_controller.c
@@ -82,7 +82,8 @@ SYS_INIT(init_port_mutex, POST_KERNEL, 50);
* will incorrectly return true. However, callers which failed to statically
* lock the port will fail quickly.
*/
-static int i2c_port_is_locked(int port)
+STATIC_IF_NOT(CONFIG_ZTEST)
+int i2c_port_is_locked(int port)
{
#ifdef CONFIG_I2C_MULTI_PORT_CONTROLLER
/* Test the controller, not the port */