diff options
author | Denis Brockus <dbrockus@google.com> | 2020-10-21 15:36:38 -0600 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-22 06:43:09 +0000 |
commit | b43a9fe859613ef85b20f75aede7213e123bbf25 (patch) | |
tree | 494d61faa34f5eb9cd0b66ad376774a21c09cf88 | |
parent | 3c75f4bd8c44b4ccf2971e18c5d8f1a5d596dffa (diff) | |
download | chrome-ec-b43a9fe859613ef85b20f75aede7213e123bbf25.tar.gz |
usb-pd: svdm_dp_attention used bit & instead of logical &&
The code works the same but it is not clear why the &&
was not chosen and no comments to give a reason. Since
both variables are always 0 or 1, the code will do
exactly the same thing but this is really what is
happening when you think about the logic behind this
comparison.
BUG=none
BRANCH=none
TEST=make buildall
Signed-off-by: Denis Brockus <dbrockus@google.com>
Change-Id: I4daf780e370978b468a5d1c22536b904a591e089
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2490733
Tested-by: Denis Brockus <dbrockus@chromium.org>
Auto-Submit: Denis Brockus <dbrockus@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Commit-Queue: Denis Brockus <dbrockus@chromium.org>
-rw-r--r-- | common/usb_pd_alt_mode_dfp.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/common/usb_pd_alt_mode_dfp.c b/common/usb_pd_alt_mode_dfp.c index ad193a35e1..3bfbcc9f35 100644 --- a/common/usb_pd_alt_mode_dfp.c +++ b/common/usb_pd_alt_mode_dfp.c @@ -1131,7 +1131,7 @@ __overridable int svdm_dp_attention(int port, uint32_t *payload) } #ifdef CONFIG_USB_PD_DP_HPD_GPIO - if (irq & !lvl) { + if (irq && !lvl) { /* * IRQ can only be generated when the level is high, because * the IRQ is signaled by a short low pulse from the high level. @@ -1140,7 +1140,7 @@ __overridable int svdm_dp_attention(int port, uint32_t *payload) return 0; /* nak */ } - if (irq & cur_lvl) { + if (irq && cur_lvl) { uint64_t now = get_time().val; /* wait for the minimum spacing between IRQ_HPD if needed */ if (now < svdm_hpd_deadline[port]) |