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 /driver | |
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 'driver')
-rw-r--r-- | driver/charger/sm5803.c | 2 | ||||
-rw-r--r-- | driver/ppc/aoz1380.c | 4 | ||||
-rw-r--r-- | driver/ppc/nx20p348x.c | 2 | ||||
-rw-r--r-- | driver/ppc/sn5s330.c | 2 | ||||
-rw-r--r-- | driver/tcpm/tcpci.c | 4 | ||||
-rw-r--r-- | driver/usb_mux/usb_mux.c | 2 |
6 files changed, 8 insertions, 8 deletions
diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c index 43a54d798b..36c4e705c2 100644 --- a/driver/charger/sm5803.c +++ b/driver/charger/sm5803.c @@ -48,7 +48,7 @@ static const struct charger_info sm5803_charger_info = { .input_current_step = INPUT_I_STEP, }; -static uint32_t irq_pending; /* Bitmask of chips with interrupts pending */ +static atomic_t irq_pending; /* Bitmask of chips with interrupts pending */ static struct mutex flow1_access_lock[CHARGER_NUM]; static struct mutex flow2_access_lock[CHARGER_NUM]; diff --git a/driver/ppc/aoz1380.c b/driver/ppc/aoz1380.c index 935503b593..726f626caf 100644 --- a/driver/ppc/aoz1380.c +++ b/driver/ppc/aoz1380.c @@ -25,12 +25,12 @@ #define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) -static uint32_t irq_pending; /* Bitmask of ports signaling an interrupt. */ +static atomic_t irq_pending; /* Bitmask of ports signaling an interrupt. */ #define AOZ1380_FLAGS_SOURCE_ENABLED BIT(0) #define AOZ1380_FLAGS_SINK_ENABLED BIT(1) #define AOZ1380_FLAGS_INT_ON_DISCONNECT BIT(2) -static uint32_t flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static atomic_t flags[CONFIG_USB_PD_PORT_MAX_COUNT]; #define AOZ1380_SET_FLAG(port, flag) atomic_or(&flags[port], (flag)) #define AOZ1380_CLR_FLAG(port, flag) atomic_clear_bits(&flags[port], (flag)) diff --git a/driver/ppc/nx20p348x.c b/driver/ppc/nx20p348x.c index b582259e04..130678d512 100644 --- a/driver/ppc/nx20p348x.c +++ b/driver/ppc/nx20p348x.c @@ -22,7 +22,7 @@ #define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) -static uint32_t irq_pending; /* Bitmask of ports signaling an interrupt. */ +static atomic_t irq_pending; /* Bitmask of ports signaling an interrupt. */ #define NX20P348X_DB_EXIT_FAIL_THRESHOLD 10 static int db_exit_fail_count[CONFIG_USB_PD_PORT_MAX_COUNT]; diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c index c45340250d..0e5934533e 100644 --- a/driver/ppc/sn5s330.c +++ b/driver/ppc/sn5s330.c @@ -26,7 +26,7 @@ #define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args) #define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args) -static uint32_t irq_pending; /* Bitmask of ports signaling an interrupt. */ +static atomic_t irq_pending; /* Bitmask of ports signaling an interrupt. */ static int source_enabled[CONFIG_USB_PD_PORT_MAX_COUNT]; static int read_reg(uint8_t port, int reg, int *regval) diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index 359cb04d30..b04d7be1af 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -877,12 +877,12 @@ struct queue { * Head points to the index of the first empty slot to put a new RX * message. Must be masked before used in lookup. */ - uint32_t head; + atomic_t head; /* * Tail points to the index of the first message for the PD task to * consume. Must be masked before used in lookup. */ - uint32_t tail; + atomic_t tail; struct cached_tcpm_message buffer[CACHE_DEPTH]; }; static struct queue cached_messages[CONFIG_USB_PD_PORT_MAX_COUNT]; diff --git a/driver/usb_mux/usb_mux.c b/driver/usb_mux/usb_mux.c index c53a21ce65..4095846c30 100644 --- a/driver/usb_mux/usb_mux.c +++ b/driver/usb_mux/usb_mux.c @@ -32,7 +32,7 @@ static int enable_debug_prints; * Flags will reset to 0 after sysjump; This works for current flags as LPM will * get reset in the init method which is called during PD task startup. */ -static uint32_t flags[CONFIG_USB_PD_PORT_MAX_COUNT]; +static atomic_t flags[CONFIG_USB_PD_PORT_MAX_COUNT]; /* Device is in low power mode. */ #define USB_MUX_FLAG_IN_LPM BIT(0) |