summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2021-11-29 10:56:55 +0100
committerCommit Bot <commit-bot@chromium.org>2021-12-07 08:50:42 +0000
commit841fd37f19b80df2cf15381b0046817e92197879 (patch)
tree41f35ea12851d6912685d3deb2af2806bdadefc0
parente3ffa051926e1c2daf60daa69e7bccf7e8894b15 (diff)
downloadchrome-ec-841fd37f19b80df2cf15381b0046817e92197879.tar.gz
ppc/syv682x: change the type sink_ocp_count to atomic_t
sink_ocp_count is used 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. sink_ocp_count[port] < OCP_COUNT_LIMIT changes the comparison instruction for cortex-m from bgeu to bge (unsigned vs signed comparison). There are similar changes for other architectures. There is no risk of overflow which would cause an invalid result of the comparison(OCP_COUNT_LIMIT=3). 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: I79e76cf413afca7cf4686988db042ffca59618c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3306357 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
-rw-r--r--driver/ppc/syv682x.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c
index 722824c53d..5e0ad344cd 100644
--- a/driver/ppc/syv682x.c
+++ b/driver/ppc/syv682x.c
@@ -30,10 +30,10 @@
#define SYV682X_FLAGS_FRS BIT(7)
#define SYV682X_FLAGS_VCONN_OCP BIT(8)
-static uint32_t irq_pending; /* Bitmask of ports signaling an interrupt. */
-static uint32_t flags[CONFIG_USB_PD_PORT_MAX_COUNT];
+static atomic_t irq_pending; /* Bitmask of ports signaling an interrupt. */
+static atomic_t flags[CONFIG_USB_PD_PORT_MAX_COUNT];
/* Running count of sink ocp events */
-static uint32_t sink_ocp_count[CONFIG_USB_PD_PORT_MAX_COUNT];
+static atomic_t sink_ocp_count[CONFIG_USB_PD_PORT_MAX_COUNT];
static timestamp_t vbus_oc_timer[CONFIG_USB_PD_PORT_MAX_COUNT];
static timestamp_t vconn_oc_timer[CONFIG_USB_PD_PORT_MAX_COUNT];