diff options
author | Dawid Niedzwiecki <dn@semihalf.com> | 2021-11-26 11:23:13 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-12-07 08:50:27 +0000 |
commit | e3ffa051926e1c2daf60daa69e7bccf7e8894b15 (patch) | |
tree | 92356cdd2e29769061b8cca732e53a0c5b71a19a | |
parent | 1b1214d973aa2d092301d8a5973b47e7c261e578 (diff) | |
download | chrome-ec-e3ffa051926e1c2daf60daa69e7bccf7e8894b15.tar.gz |
mkbp: change the type fifo_entries to atomic_t
fifo_entries is used many times with atomic_* calls, so change its
type to atomic_t.
Since atomic_t is a signed type, the commit changes asm code where
fifo_entries is compared e.g.
if (fifo_entries >= fifo_max_depth) {
changes the comparison instruction for cortex-m from bhi.n to bgt.n
(signed vs unsigned comparison). There are similar changes for other
architectures. It is not an issue, because the maximum value of
fifo_entries is FIFO_DEPTH=16 and fifo_max_depth is uint8_t, so there
is no risk of overflow which would cause an invalid result of the
comparison.
The change will be useful for incoming commits related to modifying
atomic_t caused by a change in Zephyr upstream (atomic_t from int to
long).
BUG=b:207082842
TEST=make buildall && zmake testall
BRANCH=main
Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com>
Change-Id: I5890eae25601514bd48043ac1feadd2d21f9539c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3301715
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
-rw-r--r-- | common/mkbp_fifo.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/common/mkbp_fifo.c b/common/mkbp_fifo.c index 428d6412fc..c394d9fc77 100644 --- a/common/mkbp_fifo.c +++ b/common/mkbp_fifo.c @@ -28,7 +28,7 @@ static uint32_t fifo_start; /* first entry */ static uint32_t fifo_end; /* last entry */ -static uint32_t fifo_entries; /* number of existing entries */ +static atomic_t fifo_entries; /* number of existing entries */ static uint8_t fifo_max_depth = FIFO_DEPTH; static struct ec_response_get_next_event fifo[FIFO_DEPTH]; |