summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/samus_pd/board.c2
-rw-r--r--chip/npcx/cec.c2
-rw-r--r--chip/stm32/usart_info_command.c15
-rw-r--r--chip/stm32/usart_rx_dma.c2
-rw-r--r--chip/stm32/usb.c2
-rw-r--r--chip/stm32/usb_hid_keyboard.c2
-rw-r--r--common/device_event.c2
-rw-r--r--common/fpsensor/fpsensor.c6
-rw-r--r--common/fpsensor/fpsensor_state.c2
-rw-r--r--common/motion_sense.c4
-rw-r--r--common/usb_common.c4
-rw-r--r--common/usb_pd_host_cmd.c2
-rw-r--r--common/usb_pd_protocol.c2
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c2
-rw-r--r--core/cortex-m/atomic.h2
-rw-r--r--core/cortex-m/task.c2
-rw-r--r--core/cortex-m0/atomic.h2
-rw-r--r--core/cortex-m0/task.c2
-rw-r--r--core/host/atomic.h2
-rw-r--r--core/host/task.c2
-rw-r--r--core/minute-ia/atomic.h2
-rw-r--r--core/minute-ia/task.c2
-rw-r--r--core/nds32/atomic.h2
-rw-r--r--core/nds32/task.c2
-rw-r--r--core/riscv-rv32i/atomic.h2
-rw-r--r--core/riscv-rv32i/task.c2
-rw-r--r--driver/charger/sm5803.c2
-rw-r--r--driver/ppc/aoz1380.c2
-rw-r--r--driver/ppc/nx20p348x.c2
-rw-r--r--driver/ppc/sn5s330.c2
-rw-r--r--driver/ppc/syv682x.c2
-rw-r--r--test/stm32f_rtc.c2
-rw-r--r--zephyr/shim/include/atomic.h5
33 files changed, 42 insertions, 48 deletions
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c
index 926baf78cc..00cdb9e946 100644
--- a/board/samus_pd/board.c
+++ b/board/samus_pd/board.c
@@ -611,7 +611,7 @@ host_event_status_host_cmd(struct host_cmd_handler_args *args)
atomic_clear_bits(&(pd_status_flags), PD_STATUS_HOST_EVENT);
/* Read and clear the host event status to return to AP */
- r->status = atomic_read_clear(&(host_event_status_flags));
+ r->status = atomic_clear(&(host_event_status_flags));
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;
diff --git a/chip/npcx/cec.c b/chip/npcx/cec.c
index b41e36e127..67eda331a6 100644
--- a/chip/npcx/cec.c
+++ b/chip/npcx/cec.c
@@ -963,7 +963,7 @@ DECLARE_HOST_COMMAND(EC_CMD_CEC_GET, hc_cec_get, EC_VER_MASK(0));
static int cec_get_next_event(uint8_t *out)
{
- uint32_t event_out = atomic_read_clear(&cec_events);
+ uint32_t event_out = atomic_clear(&cec_events);
memcpy(out, &event_out, sizeof(event_out));
diff --git a/chip/stm32/usart_info_command.c b/chip/stm32/usart_info_command.c
index 4e77f12980..2649a97351 100644
--- a/chip/stm32/usart_info_command.c
+++ b/chip/stm32/usart_info_command.c
@@ -20,14 +20,13 @@ static int command_usart_info(int argc, char **argv)
if (config == NULL)
continue;
- ccprintf("USART%d\n"
- " dropped %d bytes\n"
- " overran %d times\n",
- config->hw->index + 1,
- atomic_read_clear(
- (uint32_t *)&(config->state->rx_dropped)),
- atomic_read_clear(
- (uint32_t *)&(config->state->rx_overrun)));
+ ccprintf(
+ "USART%d\n"
+ " dropped %d bytes\n"
+ " overran %d times\n",
+ config->hw->index + 1,
+ atomic_clear((uint32_t *)&(config->state->rx_dropped)),
+ atomic_clear((uint32_t *)&(config->state->rx_overrun)));
if (config->rx->info)
config->rx->info(config);
diff --git a/chip/stm32/usart_rx_dma.c b/chip/stm32/usart_rx_dma.c
index 868425d086..a185878261 100644
--- a/chip/stm32/usart_rx_dma.c
+++ b/chip/stm32/usart_rx_dma.c
@@ -115,5 +115,5 @@ void usart_rx_dma_info(struct usart_config const *config)
DOWNCAST(config->rx, struct usart_rx_dma const, usart_rx);
ccprintf(" DMA RX max_bytes %d\n",
- atomic_read_clear((uint32_t *)&dma_config->state->max_bytes));
+ atomic_clear((uint32_t *)&dma_config->state->max_bytes));
}
diff --git a/chip/stm32/usb.c b/chip/stm32/usb.c
index f6e1daa8a5..63c931d7d9 100644
--- a/chip/stm32/usb.c
+++ b/chip/stm32/usb.c
@@ -517,7 +517,7 @@ void usb_wake(void)
}
/* Only allow one caller at a time. */
- if (!atomic_read_clear((int *)&usb_wake_done))
+ if (!atomic_clear((int *)&usb_wake_done))
return;
CPRINTF("WAKE\n");
diff --git a/chip/stm32/usb_hid_keyboard.c b/chip/stm32/usb_hid_keyboard.c
index f12796257c..a0b1a1d317 100644
--- a/chip/stm32/usb_hid_keyboard.c
+++ b/chip/stm32/usb_hid_keyboard.c
@@ -335,7 +335,7 @@ static void write_keyboard_report(void)
return;
}
- if (atomic_read_clear((int *)&hid_ep_data_ready)) {
+ if (atomic_clear((int *)&hid_ep_data_ready)) {
/*
* Endpoint is not busy, and interrupt handler did not just
* send the buffer: enable TX.
diff --git a/common/device_event.c b/common/device_event.c
index ca13a58574..5e6ca049e9 100644
--- a/common/device_event.c
+++ b/common/device_event.c
@@ -27,7 +27,7 @@ uint32_t device_get_current_events(void)
static uint32_t device_get_and_clear_events(void)
{
- return atomic_read_clear(&device_current_events);
+ return atomic_clear(&device_current_events);
}
static uint32_t device_get_enabled_events(void)
diff --git a/common/fpsensor/fpsensor.c b/common/fpsensor/fpsensor.c
index 2e88319b5d..6b782845f2 100644
--- a/common/fpsensor/fpsensor.c
+++ b/common/fpsensor/fpsensor.c
@@ -787,7 +787,7 @@ int command_fpenroll(int argc, char **argv)
FP_MODE_ENROLL_IMAGE);
if (rc != EC_SUCCESS)
break;
- event = atomic_read_clear(&fp_events);
+ event = atomic_clear(&fp_events);
percent = EC_MKBP_FP_ENROLL_PROGRESS(event);
CPRINTS("Enroll capture: %s (%d%%)",
enroll_str[EC_MKBP_FP_ERRCODE(event) & 3], percent);
@@ -810,7 +810,7 @@ DECLARE_CONSOLE_COMMAND_FLAGS(fpenroll, command_fpenroll, NULL,
int command_fpmatch(int argc, char **argv)
{
enum ec_error_list rc = fp_console_action(FP_MODE_MATCH);
- uint32_t event = atomic_read_clear(&fp_events);
+ uint32_t event = atomic_clear(&fp_events);
if (rc == EC_SUCCESS && event & EC_MKBP_FP_MATCH) {
uint32_t errcode = EC_MKBP_FP_ERRCODE(event);
@@ -836,7 +836,7 @@ int command_fpclear(int argc, char **argv)
if (rc < 0)
CPRINTS("Failed to clear fingerprint context: %d", rc);
- atomic_read_clear(&fp_events);
+ atomic_clear(&fp_events);
return rc;
}
diff --git a/common/fpsensor/fpsensor_state.c b/common/fpsensor/fpsensor_state.c
index ec4ddb4fd9..70568d8ec4 100644
--- a/common/fpsensor/fpsensor_state.c
+++ b/common/fpsensor/fpsensor_state.c
@@ -100,7 +100,7 @@ void fp_reset_and_clear_context(void)
int fp_get_next_event(uint8_t *out)
{
- uint32_t event_out = atomic_read_clear(&fp_events);
+ uint32_t event_out = atomic_clear(&fp_events);
memcpy(out, &event_out, sizeof(event_out));
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 6feed6738d..2869f93984 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -677,7 +677,7 @@ static int motion_sense_process(struct motion_sensor_t *sensor,
if (*event & TASK_EVENT_MOTION_ODR_CHANGE) {
const int sensor_bit = 1 << sensor_num;
- int odr_pending = atomic_read_clear(&odr_event_required);
+ int odr_pending = atomic_clear(&odr_event_required);
is_odr_pending = odr_pending & sensor_bit;
odr_pending &= ~sensor_bit;
@@ -707,7 +707,7 @@ static int motion_sense_process(struct motion_sensor_t *sensor,
}
if (IS_ENABLED(CONFIG_ACCEL_FIFO) &&
*event & TASK_EVENT_MOTION_FLUSH_PENDING) {
- int flush_pending = atomic_read_clear(&sensor->flush_pending);
+ int flush_pending = atomic_clear(&sensor->flush_pending);
for (; flush_pending > 0; flush_pending--) {
motion_sense_fifo_insert_async_event(
diff --git a/common/usb_common.c b/common/usb_common.c
index 7053607433..c9100d15ad 100644
--- a/common/usb_common.c
+++ b/common/usb_common.c
@@ -468,7 +468,7 @@ static uint32_t port_oc_reset_req;
static void re_enable_ports(void)
{
- uint32_t ports = atomic_read_clear(&port_oc_reset_req);
+ uint32_t ports = atomic_clear(&port_oc_reset_req);
while (ports) {
int port = __fls(ports);
@@ -747,7 +747,7 @@ static uint32_t pd_ports_to_resume;
static void resume_pd_port(void)
{
uint32_t port;
- uint32_t suspended_ports = atomic_read_clear(&pd_ports_to_resume);
+ uint32_t suspended_ports = atomic_clear(&pd_ports_to_resume);
while (suspended_ports) {
port = __builtin_ctz(suspended_ports);
diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c
index b9458bca67..11174ee7d4 100644
--- a/common/usb_pd_host_cmd.c
+++ b/common/usb_pd_host_cmd.c
@@ -611,7 +611,7 @@ hc_pd_host_event_status(struct host_cmd_handler_args *args)
struct ec_response_host_event_status *r = args->response;
/* Read and clear the host event status to return to AP */
- r->status = atomic_read_clear(&pd_host_event_status);
+ r->status = atomic_clear(&pd_host_event_status);
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index be17b187e8..4b1a79d07c 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -534,7 +534,7 @@ static int reset_device_and_notify(int port)
atomic_clear_bits(task_get_event_bitmap(task_get_current()),
PD_EVENT_TCPC_RESET);
- waiting_tasks = atomic_read_clear(&pd[port].tasks_waiting_on_reset);
+ waiting_tasks = atomic_clear(&pd[port].tasks_waiting_on_reset);
/*
* Now that we are done waking up the device, handle device access
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 4785aa9b91..05e5f2ec94 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -1779,7 +1779,7 @@ static __maybe_unused int reset_device_and_notify(int port)
atomic_clear_bits(task_get_event_bitmap(task_get_current()),
PD_EVENT_TCPC_RESET);
- waiting_tasks = atomic_read_clear(&tc[port].tasks_waiting_on_reset);
+ waiting_tasks = atomic_clear(&tc[port].tasks_waiting_on_reset);
/* Wake up all waiting tasks. */
while (waiting_tasks) {
diff --git a/core/cortex-m/atomic.h b/core/cortex-m/atomic.h
index 67abfa4a77..4446fb989c 100644
--- a/core/cortex-m/atomic.h
+++ b/core/cortex-m/atomic.h
@@ -33,7 +33,7 @@ static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
return __atomic_fetch_sub(addr, value, __ATOMIC_SEQ_CST);
}
-static inline atomic_val_t atomic_read_clear(atomic_t *addr)
+static inline atomic_val_t atomic_clear(atomic_t *addr)
{
return __atomic_exchange_n(addr, 0, __ATOMIC_SEQ_CST);
}
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index 9c3068bbc0..8cecafffa3 100644
--- a/core/cortex-m/task.c
+++ b/core/cortex-m/task.c
@@ -413,7 +413,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
ret = timer_arm(deadline, me);
ASSERT(ret == EC_SUCCESS);
}
- while (!(evt = atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_clear(&tsk->events))) {
/* Remove ourself and get the next task in the scheduler */
__schedule(1, resched);
resched = TASK_ID_IDLE;
diff --git a/core/cortex-m0/atomic.h b/core/cortex-m0/atomic.h
index ad07beee35..79924fa234 100644
--- a/core/cortex-m0/atomic.h
+++ b/core/cortex-m0/atomic.h
@@ -54,7 +54,7 @@ static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
return ATOMIC_OP(sub, addr, value);
}
-static inline atomic_val_t atomic_read_clear(atomic_t *addr)
+static inline atomic_val_t atomic_clear(atomic_t *addr)
{
atomic_t ret;
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c
index d8ed4a6376..67da26008e 100644
--- a/core/cortex-m0/task.c
+++ b/core/cortex-m0/task.c
@@ -334,7 +334,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
ret = timer_arm(deadline, me);
ASSERT(ret == EC_SUCCESS);
}
- while (!(evt = atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_clear(&tsk->events))) {
/*
* We need to ensure that the execution priority is actually
* decreased after the "cpsie i" in the atomic operation above
diff --git a/core/host/atomic.h b/core/host/atomic.h
index aaf990dac1..1513823b6f 100644
--- a/core/host/atomic.h
+++ b/core/host/atomic.h
@@ -33,7 +33,7 @@ static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
return __atomic_fetch_sub(addr, value, __ATOMIC_SEQ_CST);
}
-static inline atomic_val_t atomic_read_clear(atomic_t *addr)
+static inline atomic_val_t atomic_clear(atomic_t *addr)
{
return __atomic_exchange_n(addr, 0, __ATOMIC_SEQ_CST);
}
diff --git a/core/host/task.c b/core/host/task.c
index e73f8c57fe..6b3ff31a81 100644
--- a/core/host/task.c
+++ b/core/host/task.c
@@ -224,7 +224,7 @@ uint32_t task_wait_event(int timeout_us)
pthread_cond_wait(&tasks[tid].resume, &run_lock);
/* Resume */
- ret = atomic_read_clear(&tasks[tid].event);
+ ret = atomic_clear(&tasks[tid].event);
pthread_mutex_unlock(&interrupt_lock);
return ret;
}
diff --git a/core/minute-ia/atomic.h b/core/minute-ia/atomic.h
index 7c63268963..225bf0329d 100644
--- a/core/minute-ia/atomic.h
+++ b/core/minute-ia/atomic.h
@@ -62,7 +62,7 @@ static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
return __atomic_fetch_sub(addr, value, __ATOMIC_SEQ_CST);
}
-static inline atomic_val_t atomic_read_clear(atomic_t *addr)
+static inline atomic_val_t atomic_clear(atomic_t *addr)
{
return __atomic_exchange_n(addr, 0, __ATOMIC_SEQ_CST);
}
diff --git a/core/minute-ia/task.c b/core/minute-ia/task.c
index 8a54772ada..6d5be5f92d 100644
--- a/core/minute-ia/task.c
+++ b/core/minute-ia/task.c
@@ -318,7 +318,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
ret = timer_arm(deadline, me);
ASSERT(ret == EC_SUCCESS);
}
- while (!(evt = atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_clear(&tsk->events))) {
/* Remove ourself and get the next task in the scheduler */
__schedule(1, resched);
resched = TASK_ID_IDLE;
diff --git a/core/nds32/atomic.h b/core/nds32/atomic.h
index f42b91614f..00df72cbcb 100644
--- a/core/nds32/atomic.h
+++ b/core/nds32/atomic.h
@@ -60,7 +60,7 @@ static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
return ret;
}
-static inline atomic_val_t atomic_read_clear(atomic_t *addr)
+static inline atomic_val_t atomic_clear(atomic_t *addr)
{
atomic_val_t ret;
atomic_t volatile *ptr = addr;
diff --git a/core/nds32/task.c b/core/nds32/task.c
index 2fc2302c67..6c0766635f 100644
--- a/core/nds32/task.c
+++ b/core/nds32/task.c
@@ -403,7 +403,7 @@ static uint32_t __ram_code __wait_evt(int timeout_us, task_id_t resched)
ret = timer_arm(deadline, me);
ASSERT(ret == EC_SUCCESS);
}
- while (!(evt = atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_clear(&tsk->events))) {
/* Remove ourself and get the next task in the scheduler */
__schedule(1, resched, 0);
resched = TASK_ID_IDLE;
diff --git a/core/riscv-rv32i/atomic.h b/core/riscv-rv32i/atomic.h
index c8baf9d42b..a4e9db66ed 100644
--- a/core/riscv-rv32i/atomic.h
+++ b/core/riscv-rv32i/atomic.h
@@ -35,7 +35,7 @@ static inline atomic_val_t atomic_sub(atomic_t *addr, atomic_val_t value)
return __atomic_fetch_sub(addr, value, __ATOMIC_SEQ_CST);
}
-static inline atomic_val_t atomic_read_clear(atomic_t *addr)
+static inline atomic_val_t atomic_clear(atomic_t *addr)
{
return __atomic_exchange_n(addr, 0, __ATOMIC_SEQ_CST);
}
diff --git a/core/riscv-rv32i/task.c b/core/riscv-rv32i/task.c
index b5f78b12d4..e39e854a3e 100644
--- a/core/riscv-rv32i/task.c
+++ b/core/riscv-rv32i/task.c
@@ -397,7 +397,7 @@ static uint32_t __ram_code __wait_evt(int timeout_us, task_id_t resched)
ret = timer_arm(deadline, me);
ASSERT(ret == EC_SUCCESS);
}
- while (!(evt = atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_clear(&tsk->events))) {
/* Remove ourself and get the next task in the scheduler */
__schedule(1, resched, 0);
resched = TASK_ID_IDLE;
diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c
index 1b1de492d8..3bc57c94ec 100644
--- a/driver/charger/sm5803.c
+++ b/driver/charger/sm5803.c
@@ -1055,7 +1055,7 @@ void sm5803_handle_interrupt(int chgnum)
static void sm5803_irq_deferred(void)
{
int i;
- uint32_t pending = atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_clear(&irq_pending);
for (i = 0; i < CHARGER_NUM; i++)
if (BIT(i) & pending)
diff --git a/driver/ppc/aoz1380.c b/driver/ppc/aoz1380.c
index 4936647f37..98605fe08b 100644
--- a/driver/ppc/aoz1380.c
+++ b/driver/ppc/aoz1380.c
@@ -143,7 +143,7 @@ static void aoz1380_handle_interrupt(int port)
static void aoz1380_irq_deferred(void)
{
int i;
- uint32_t pending = atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_clear(&irq_pending);
for (i = 0; i < board_get_usb_pd_port_count(); i++)
if (BIT(i) & pending)
diff --git a/driver/ppc/nx20p348x.c b/driver/ppc/nx20p348x.c
index 8142681bb4..40a7bb792a 100644
--- a/driver/ppc/nx20p348x.c
+++ b/driver/ppc/nx20p348x.c
@@ -384,7 +384,7 @@ static void nx20p348x_handle_interrupt(int port)
static void nx20p348x_irq_deferred(void)
{
int i;
- uint32_t pending = atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_clear(&irq_pending);
for (i = 0; i < board_get_usb_pd_port_count(); i++)
if (BIT(i) & pending)
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c
index f177efa10c..4d9a25d43b 100644
--- a/driver/ppc/sn5s330.c
+++ b/driver/ppc/sn5s330.c
@@ -712,7 +712,7 @@ static void sn5s330_handle_interrupt(int port)
static void sn5s330_irq_deferred(void)
{
int i;
- uint32_t pending = atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_clear(&irq_pending);
for (i = 0; i < board_get_usb_pd_port_count(); i++)
if (BIT(i) & pending)
diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c
index aac9191999..bd20ecc1f1 100644
--- a/driver/ppc/syv682x.c
+++ b/driver/ppc/syv682x.c
@@ -508,7 +508,7 @@ static void syv682x_handle_interrupt(int port)
static void syv682x_irq_deferred(void)
{
int i;
- uint32_t pending = atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_clear(&irq_pending);
for (i = 0; i < board_get_usb_pd_port_count(); i++)
if (BIT(i) & pending)
diff --git a/test/stm32f_rtc.c b/test/stm32f_rtc.c
index fc1d0aaedb..52bccabebd 100644
--- a/test/stm32f_rtc.c
+++ b/test/stm32f_rtc.c
@@ -29,7 +29,7 @@ test_static int test_rtc_alarm(void)
msleep(2 * rtc_delay_ms);
/* Make sure the interrupt fired exactly once. */
- TEST_EQ(1, atomic_read_clear(&rtc_fired), "%d");
+ TEST_EQ(1, atomic_clear(&rtc_fired), "%d");
rtc_diff_us = get_rtc_diff(&rtc, &rtc_irq);
diff --git a/zephyr/shim/include/atomic.h b/zephyr/shim/include/atomic.h
index f3efe18fe8..5ae6635f75 100644
--- a/zephyr/shim/include/atomic.h
+++ b/zephyr/shim/include/atomic.h
@@ -13,9 +13,4 @@ static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
atomic_and(addr, ~bits);
}
-static inline atomic_val_t atomic_read_clear(atomic_t *addr)
-{
- return atomic_clear(addr);
-}
-
#endif /* __CROS_EC_ATOMIC_H */