diff options
author | Dawid Niedzwiecki <dn@semihalf.com> | 2021-11-29 11:08:48 +0100 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-12-08 09:02:59 +0000 |
commit | 4f7cd7509d7a02b1d5f3f0fd3885202350b576f1 (patch) | |
tree | aadf304662b4436fcdbe352fcc27c009967faf7c /common/device_event.c | |
parent | de14a76701c668270f19c8d6af41aaa321f1c8c2 (diff) | |
download | chrome-ec-4f7cd7509d7a02b1d5f3f0fd3885202350b576f1.tar.gz |
atomic: use atomic_t where it is possible
There are several places where atomic_t can be a type variables that
are use with atomic_* operation, so use it.
It sometimes has an impact on the asm code, but it is not significant.
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: I5c7fa6b74b84454b22074a2a00b5f10003ee9843
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3306358
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Keith Short <keithshort@chromium.org>
Reviewed-by: Tom Hughes <tomhughes@chromium.org>
Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
Diffstat (limited to 'common/device_event.c')
-rw-r--r-- | common/device_event.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/common/device_event.c b/common/device_event.c index f7944ae930..748a98ae8f 100644 --- a/common/device_event.c +++ b/common/device_event.c @@ -17,8 +17,8 @@ #define CPUTS(outstr) cputs(CC_EVENTS, outstr) #define CPRINTS(format, args...) cprints(CC_EVENTS, format, ## args) -static uint32_t device_current_events; -static uint32_t device_enabled_events; +static atomic_t device_current_events; +static atomic_t device_enabled_events; uint32_t device_get_current_events(void) { @@ -40,7 +40,7 @@ void device_set_events(uint32_t mask) /* Ignore events that are not enabled */ mask &= device_enabled_events; - if ((device_current_events & mask) != mask) { + if (((uint32_t)device_current_events & mask) != mask) { CPRINTS("device event set 0x%08x", mask); } else { /* @@ -64,7 +64,7 @@ void device_set_events(uint32_t mask) void device_clear_events(uint32_t mask) { /* Only print if something's about to change */ - if (device_current_events & mask) + if ((uint32_t)device_current_events & mask) CPRINTS("device event clear 0x%08x", mask); atomic_clear_bits(&device_current_events, mask); |