diff options
author | Yuval Peress <peress@chromium.org> | 2021-04-15 00:30:17 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-04-15 17:35:46 +0000 |
commit | 654e8de3ae38ba76bbec24167899f9f90c1f1fab (patch) | |
tree | e6c42195255f52b4dadb0670c53fe889597c49c2 /common/i2c_controller.c | |
parent | e8c27e50fe1a3c40a1dfa53843a9aec754901c6d (diff) | |
download | chrome-ec-654e8de3ae38ba76bbec24167899f9f90c1f1fab.tar.gz |
zephyr: i2c: Fix use of I2C_PORT_VIRTUAL_BATTERY
In Zephyr builds, the I2C_PORT_* values are enums generated from
devicetree (instead of #define values). This means that in Zephyr,
it should suffice to just check VIRTUAL_BATTERY_ADDR_FLAGS.
BRANCH=none
BUG=b:185392974
TEST=zmake testall
TEST=make buildall
Signed-off-by: Yuval Peress <peress@chromium.org>
Change-Id: Ifedaf45ec8bcfa33bb75c8381604ad565ca08d6a
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2826919
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'common/i2c_controller.c')
-rw-r--r-- | common/i2c_controller.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/common/i2c_controller.c b/common/i2c_controller.c index 2b5dbd99fd..5b04e079fb 100644 --- a/common/i2c_controller.c +++ b/common/i2c_controller.c @@ -1218,7 +1218,8 @@ static enum ec_status i2c_command_passthru(struct host_cmd_handler_args *args) if (resp->num_msgs == params->num_msgs - 1) xferflags |= I2C_XFER_STOP; -#if defined(VIRTUAL_BATTERY_ADDR_FLAGS) && defined(I2C_PORT_VIRTUAL_BATTERY) +#if defined(VIRTUAL_BATTERY_ADDR_FLAGS) && \ + (defined(CONFIG_ZEPHYR) || defined(I2C_PORT_VIRTUAL_BATTERY)) if (params->port == I2C_PORT_VIRTUAL_BATTERY && addr_flags == VIRTUAL_BATTERY_ADDR_FLAGS) { if (virtual_battery_handler(resp, in_len, &rv, |