summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Semjonovs <asemjonovs@google.com>2022-01-26 12:59:01 -0700
committerCommit Bot <commit-bot@chromium.org>2022-01-28 22:14:12 +0000
commit4143c7deffdd18e9e112e7f7f76173db5484b591 (patch)
treedf43b82a938d2a98469bed5ac6fbf77f617fe8c9
parent4a6ee66519fd49ce405614de30655ff637b4788b (diff)
downloadchrome-ec-4143c7deffdd18e9e112e7f7f76173db5484b591.tar.gz
zephyr: drivers: Fix GPIO zephyr/ec flag conversion
Any bitwise AND with 0 will always be FALSE BRANCH=none BUG=b:216483477 TEST=zmake testall Signed-off-by: Al Semjonovs <asemjonovs@google.com> Change-Id: I5806d6f4189b587e2ae22ed836e2eb2bba649d74 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3417022 Reviewed-by: Yuval Peress <peress@google.com>
-rw-r--r--zephyr/shim/src/gpio.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/zephyr/shim/src/gpio.c b/zephyr/shim/src/gpio.c
index 8dafe6e93a..66018a6399 100644
--- a/zephyr/shim/src/gpio.c
+++ b/zephyr/shim/src/gpio.c
@@ -194,8 +194,8 @@ int convert_from_zephyr_flags(const gpio_flags_t zephyr)
unhandled_flags);
}
- if (zephyr & GPIO_DISCONNECTED)
- ec_flags |= GPIO_FLAG_NONE;
+ if (zephyr == GPIO_DISCONNECTED)
+ ec_flags = GPIO_FLAG_NONE;
if (zephyr & GPIO_OUTPUT_INIT_LOW)
ec_flags |= GPIO_LOW;
if (zephyr & GPIO_OUTPUT_INIT_HIGH)
@@ -233,8 +233,8 @@ gpio_flags_t convert_to_zephyr_flags(int ec_flags)
unhandled_flags);
}
- if (ec_flags & GPIO_FLAG_NONE)
- zephyr_flags |= GPIO_DISCONNECTED;
+ if (ec_flags == GPIO_FLAG_NONE)
+ zephyr_flags = GPIO_DISCONNECTED;
if (ec_flags & GPIO_LOW)
zephyr_flags |= GPIO_OUTPUT_INIT_LOW;
if (ec_flags & GPIO_HIGH)