summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2020-10-07 12:13:52 +0200
committerCommit Bot <commit-bot@chromium.org>2020-10-27 09:35:49 +0000
commita05f7b9f469e7c171f4a737968ab5cbd11ba1253 (patch)
treeab128a89ce9206ca967ad104e307d6c0b4c33a52
parent3cba51e9e807e7015d81c2891c47ea4c59587a1c (diff)
downloadchrome-ec-a05f7b9f469e7c171f4a737968ab5cbd11ba1253.tar.gz
tree: Use new atomic_* implementation
It is done as a part of porting to Zephyr. Since the implementation of atomic functions is done for all architectures use atomic_* instead of deprecated_atomic_*. Sometimes there was a compilation error "discards 'volatile' qualifier" due to dropping "volatile" in the argument of the functions, thus some pointers casts need to be made. It shouldn't cause any issues, because we are sure about generated asm (store operation will be performed). BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I98f590c323c3af52035e62825e8acfa358e0805a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2478949 Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org>
-rw-r--r--baseboard/dedede/variant_ec_it8320.c4
-rw-r--r--baseboard/dedede/variant_ec_npcx796fc.c4
-rw-r--r--baseboard/hatch/baseboard.c4
-rw-r--r--board/samus/power_sequence.c4
-rw-r--r--board/samus_pd/board.c10
-rw-r--r--board/twinkie/sniffer.c5
-rw-r--r--chip/ish/uart.c2
-rw-r--r--chip/lm4/i2c.c4
-rw-r--r--chip/mt8192_scp/ipi.c4
-rw-r--r--chip/npcx/cec.c4
-rw-r--r--chip/stm32/pwm.c6
-rw-r--r--chip/stm32/usart_info_command.c8
-rw-r--r--chip/stm32/usart_rx_dma.c4
-rw-r--r--chip/stm32/usart_rx_interrupt-stm32f4.c2
-rw-r--r--chip/stm32/usart_rx_interrupt-stm32l.c4
-rw-r--r--chip/stm32/usart_rx_interrupt.c2
-rw-r--r--chip/stm32/usb.c2
-rw-r--r--chip/stm32/usb_hid_keyboard.c2
-rw-r--r--common/button.c9
-rw-r--r--common/charge_manager.c4
-rw-r--r--common/device_event.c6
-rw-r--r--common/dptf.c8
-rw-r--r--common/fpsensor/fpsensor.c8
-rw-r--r--common/fpsensor/fpsensor_state.c2
-rw-r--r--common/host_event_commands.c8
-rw-r--r--common/keyboard_mkbp.c4
-rw-r--r--common/keyboard_scan.c5
-rw-r--r--common/motion_sense.c17
-rw-r--r--common/timer.c10
-rw-r--r--common/usb_common.c9
-rw-r--r--common/usb_pd_host_cmd.c6
-rw-r--r--common/usb_pd_protocol.c18
-rw-r--r--common/usbc/usb_pe_drp_sm.c26
-rw-r--r--common/usbc/usb_prl_sm.c26
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c58
-rw-r--r--common/usbc_ppc.c6
-rw-r--r--core/cortex-m/task.c28
-rw-r--r--core/cortex-m0/task.c21
-rw-r--r--core/host/task.c8
-rw-r--r--core/minute-ia/task.c23
-rw-r--r--core/nds32/task.c17
-rw-r--r--core/riscv-rv32i/task.c21
-rw-r--r--driver/charger/sm5803.c4
-rw-r--r--driver/ppc/aoz1380.c9
-rw-r--r--driver/ppc/nx20p348x.c4
-rw-r--r--driver/ppc/sn5s330.c4
-rw-r--r--driver/ppc/syv682x.c4
-rw-r--r--driver/tcpm/tcpci.c4
-rw-r--r--include/system.h8
-rw-r--r--test/stm32f_rtc.c4
-rw-r--r--zephyr/shim/include/atomic.h32
51 files changed, 221 insertions, 275 deletions
diff --git a/baseboard/dedede/variant_ec_it8320.c b/baseboard/dedede/variant_ec_it8320.c
index d7e2785c4a..227226c667 100644
--- a/baseboard/dedede/variant_ec_it8320.c
+++ b/baseboard/dedede/variant_ec_it8320.c
@@ -20,7 +20,7 @@
static void pp3300_a_pgood_low(void)
{
- deprecated_atomic_clear_bits(&pp3300_a_pgood, 1);
+ atomic_clear_bits(&pp3300_a_pgood, 1);
/* Disable low interrupt while asserted */
vcmp_enable(VCMP_SNS_PP3300_LOW, 0);
@@ -37,7 +37,7 @@ static void pp3300_a_pgood_low(void)
static void pp3300_a_pgood_high(void)
{
- deprecated_atomic_or(&pp3300_a_pgood, 1);
+ atomic_or(&pp3300_a_pgood, 1);
/* Disable high interrupt while asserted */
vcmp_enable(VCMP_SNS_PP3300_HIGH, 0);
diff --git a/baseboard/dedede/variant_ec_npcx796fc.c b/baseboard/dedede/variant_ec_npcx796fc.c
index ae7890c473..bd2cd9b8f2 100644
--- a/baseboard/dedede/variant_ec_npcx796fc.c
+++ b/baseboard/dedede/variant_ec_npcx796fc.c
@@ -26,7 +26,7 @@
void pp3300_a_pgood_high(void)
{
- deprecated_atomic_or(&pp3300_a_pgood, 1);
+ atomic_or(&pp3300_a_pgood, 1);
/* Disable this interrupt while it's asserted. */
npcx_adc_thresh_int_enable(NPCX_ADC_THRESH1, 0);
@@ -42,7 +42,7 @@ void pp3300_a_pgood_high(void)
void pp3300_a_pgood_low(void)
{
- deprecated_atomic_clear_bits(&pp3300_a_pgood, 1);
+ atomic_clear_bits(&pp3300_a_pgood, 1);
/* Disable this interrupt while it's asserted. */
npcx_adc_thresh_int_enable(NPCX_ADC_THRESH2, 0);
diff --git a/baseboard/hatch/baseboard.c b/baseboard/hatch/baseboard.c
index 367f83e8d2..97fd870242 100644
--- a/baseboard/hatch/baseboard.c
+++ b/baseboard/hatch/baseboard.c
@@ -343,9 +343,9 @@ void baseboard_mst_enable_control(enum mst_source src, int level)
static uint32_t mst_input_levels;
if (level)
- deprecated_atomic_or(&mst_input_levels, 1 << src);
+ atomic_or(&mst_input_levels, 1 << src);
else
- deprecated_atomic_clear_bits(&mst_input_levels, 1 << src);
+ atomic_clear_bits(&mst_input_levels, 1 << src);
gpio_set_level(GPIO_EN_MST, mst_input_levels ? 1 : 0);
}
diff --git a/board/samus/power_sequence.c b/board/samus/power_sequence.c
index f6033055c4..c3643e5c23 100644
--- a/board/samus/power_sequence.c
+++ b/board/samus/power_sequence.c
@@ -502,9 +502,9 @@ enum power_state power_handle_state(enum power_state state)
void set_pp5000_in_g3(int mask, int enable)
{
if (enable)
- deprecated_atomic_or(&pp5000_in_g3, mask);
+ atomic_or(&pp5000_in_g3, mask);
else
- deprecated_atomic_clear_bits(&pp5000_in_g3, mask);
+ atomic_clear_bits(&pp5000_in_g3, mask);
/* if we are in G3 now, then set the rail accordingly */
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
diff --git a/board/samus_pd/board.c b/board/samus_pd/board.c
index 0f9c8cfbfe..926baf78cc 100644
--- a/board/samus_pd/board.c
+++ b/board/samus_pd/board.c
@@ -491,8 +491,8 @@ void pd_send_host_event(int mask)
if (!mask)
return;
- deprecated_atomic_or(&(host_event_status_flags), mask);
- deprecated_atomic_or(&(pd_status_flags), PD_STATUS_HOST_EVENT);
+ atomic_or(&(host_event_status_flags), mask);
+ atomic_or(&(pd_status_flags), PD_STATUS_HOST_EVENT);
pd_send_ec_int();
}
@@ -593,7 +593,7 @@ static enum ec_status ec_status_host_cmd(struct host_cmd_handler_args *args)
r->status = pd_status_flags;
/* Clear host event */
- deprecated_atomic_clear_bits(&(pd_status_flags), PD_STATUS_HOST_EVENT);
+ atomic_clear_bits(&(pd_status_flags), PD_STATUS_HOST_EVENT);
args->response_size = sizeof(*r);
@@ -608,10 +608,10 @@ host_event_status_host_cmd(struct host_cmd_handler_args *args)
struct ec_response_host_event_status *r = args->response;
/* Clear host event bit to avoid sending more unnecessary events */
- deprecated_atomic_clear_bits(&(pd_status_flags), PD_STATUS_HOST_EVENT);
+ atomic_clear_bits(&(pd_status_flags), PD_STATUS_HOST_EVENT);
/* Read and clear the host event status to return to AP */
- r->status = deprecated_atomic_read_clear(&(host_event_status_flags));
+ r->status = atomic_read_clear(&(host_event_status_flags));
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;
diff --git a/board/twinkie/sniffer.c b/board/twinkie/sniffer.c
index 6eb2e0824e..90359ba5e8 100644
--- a/board/twinkie/sniffer.c
+++ b/board/twinkie/sniffer.c
@@ -316,10 +316,9 @@ void sniffer_task(void)
+ (EP_PACKET_HEADER_SIZE>>1))),
samples[d >> 4]+off,
EP_PAYLOAD_SIZE);
- deprecated_atomic_clear_bits((uint32_t *)&free_usb,
- 1 << u);
+ atomic_clear_bits((uint32_t *)&free_usb, 1 << u);
u = !u;
- deprecated_atomic_clear_bits(&filled_dma, 1 << d);
+ atomic_clear_bits((uint32_t *)&filled_dma, 1 << d);
}
led_reset_record();
diff --git a/chip/ish/uart.c b/chip/ish/uart.c
index b0f21cdf5f..d958dc94c5 100644
--- a/chip/ish/uart.c
+++ b/chip/ish/uart.c
@@ -264,7 +264,7 @@ static int uart_client_init(enum UART_PORT id, uint32_t baud_rate_id, int flags)
uart_ctx[id].client_flags = flags;
- deprecated_atomic_and(&uart_ctx[id].uart_state, ~UART_STATE_CG);
+ atomic_and(&uart_ctx[id].uart_state, ~UART_STATE_CG);
uart_hw_init(id);
return EC_SUCCESS;
diff --git a/chip/lm4/i2c.c b/chip/lm4/i2c.c
index 0608b433bc..b5a9e566d7 100644
--- a/chip/lm4/i2c.c
+++ b/chip/lm4/i2c.c
@@ -202,9 +202,9 @@ int chip_i2c_xfer(const int port, const uint16_t slave_addr_flags,
i2c_unwedge(port);
/* Clock timeout or arbitration lost. Reset port to clear. */
- deprecated_atomic_or(LM4_SYSTEM_SRI2C_ADDR, BIT(port));
+ atomic_or(LM4_SYSTEM_SRI2C_ADDR, BIT(port));
clock_wait_cycles(3);
- deprecated_atomic_clear_bits(LM4_SYSTEM_SRI2C_ADDR, BIT(port));
+ atomic_clear_bits(LM4_SYSTEM_SRI2C_ADDR, BIT(port));
clock_wait_cycles(3);
/* Restore settings */
diff --git a/chip/mt8192_scp/ipi.c b/chip/mt8192_scp/ipi.c
index a6b2028329..fba511a642 100644
--- a/chip/mt8192_scp/ipi.c
+++ b/chip/mt8192_scp/ipi.c
@@ -30,13 +30,13 @@ static uint32_t disable_irq_count, saved_int_mask;
void ipi_disable_irq(void)
{
- if (deprecated_atomic_read_add(&disable_irq_count, 1) == 0)
+ if (atomic_read_add(&disable_irq_count, 1) == 0)
saved_int_mask = read_clear_int_mask();
}
void ipi_enable_irq(void)
{
- if (deprecated_atomic_read_sub(&disable_irq_count, 1) == 1)
+ if (atomic_read_sub(&disable_irq_count, 1) == 1)
set_int_mask(saved_int_mask);
}
diff --git a/chip/npcx/cec.c b/chip/npcx/cec.c
index 76fbf8279f..b41e36e127 100644
--- a/chip/npcx/cec.c
+++ b/chip/npcx/cec.c
@@ -256,7 +256,7 @@ static uint32_t apb1_freq_div_10k;
static void send_mkbp_event(uint32_t event)
{
- deprecated_atomic_or(&cec_events, event);
+ atomic_or(&cec_events, event);
mkbp_send_event(EC_MKBP_EVENT_CEC_EVENT);
}
@@ -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 = deprecated_atomic_read_clear(&cec_events);
+ uint32_t event_out = atomic_read_clear(&cec_events);
memcpy(out, &event_out, sizeof(event_out));
diff --git a/chip/stm32/pwm.c b/chip/stm32/pwm.c
index ce9c4ae04b..0b339399c9 100644
--- a/chip/stm32/pwm.c
+++ b/chip/stm32/pwm.c
@@ -99,7 +99,7 @@ static void pwm_configure(enum pwm_channel ch)
/* Enable auto-reload preload, start counting */
tim->cr1 |= BIT(7) | BIT(0);
- deprecated_atomic_or(&using_pwm, 1 << ch);
+ atomic_or(&using_pwm, 1 << ch);
/* Prevent sleep */
disable_sleep(SLEEP_MASK_PWM);
@@ -125,7 +125,7 @@ static void pwm_disable(enum pwm_channel ch)
/* Allow sleep */
enable_sleep(SLEEP_MASK_PWM);
- deprecated_atomic_clear_bits(&using_pwm, 1 << ch);
+ atomic_clear_bits(&using_pwm, 1 << ch);
/* Unless another PWM is active... Then prevent sleep */
if (using_pwm)
@@ -147,7 +147,7 @@ int pwm_get_enabled(enum pwm_channel ch)
static void pwm_reconfigure(enum pwm_channel ch)
{
- deprecated_atomic_clear_bits(&using_pwm, 1 << ch);
+ atomic_clear_bits(&using_pwm, 1 << ch);
pwm_configure(ch);
}
diff --git a/chip/stm32/usart_info_command.c b/chip/stm32/usart_info_command.c
index 16d5e5747e..4e77f12980 100644
--- a/chip/stm32/usart_info_command.c
+++ b/chip/stm32/usart_info_command.c
@@ -24,10 +24,10 @@ static int command_usart_info(int argc, char **argv)
" dropped %d bytes\n"
" overran %d times\n",
config->hw->index + 1,
- deprecated_atomic_read_clear(
- &(config->state->rx_dropped)),
- deprecated_atomic_read_clear(
- &(config->state->rx_overrun)));
+ atomic_read_clear(
+ (uint32_t *)&(config->state->rx_dropped)),
+ atomic_read_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 1867c0a310..868425d086 100644
--- a/chip/stm32/usart_rx_dma.c
+++ b/chip/stm32/usart_rx_dma.c
@@ -81,7 +81,7 @@ static void usart_rx_dma_interrupt_common(
/* (new_index == old_index): nothing to add to the queue. */
}
- deprecated_atomic_add(&config->state->rx_dropped, new_bytes - added);
+ atomic_add((uint32_t *)&(config->state->rx_dropped), new_bytes - added);
if (dma_config->state->max_bytes < new_bytes)
dma_config->state->max_bytes = new_bytes;
@@ -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",
- deprecated_atomic_read_clear(&dma_config->state->max_bytes));
+ atomic_read_clear((uint32_t *)&dma_config->state->max_bytes));
}
diff --git a/chip/stm32/usart_rx_interrupt-stm32f4.c b/chip/stm32/usart_rx_interrupt-stm32f4.c
index 44e711327d..198c6dd180 100644
--- a/chip/stm32/usart_rx_interrupt-stm32f4.c
+++ b/chip/stm32/usart_rx_interrupt-stm32f4.c
@@ -33,7 +33,7 @@ static void usart_rx_interrupt_handler(struct usart_config const *config)
uint8_t byte = STM32_USART_RDR(base);
if (!queue_add_unit(config->producer.queue, &byte))
- deprecated_atomic_add(&config->state->rx_dropped, 1);
+ atomic_add((uint32_t *)&(config->state->rx_dropped), 1);
}
}
diff --git a/chip/stm32/usart_rx_interrupt-stm32l.c b/chip/stm32/usart_rx_interrupt-stm32l.c
index c0cd03d8c9..24ca7a0487 100644
--- a/chip/stm32/usart_rx_interrupt-stm32l.c
+++ b/chip/stm32/usart_rx_interrupt-stm32l.c
@@ -39,14 +39,14 @@ static void usart_rx_interrupt_handler(struct usart_config const *config)
if (!(status & STM32_USART_SR_RXNE))
(void)STM32_USART_RDR(config->hw->base);
- deprecated_atomic_add(&config->state->rx_overrun, 1);
+ atomic_add((uint32_t *)&(config->state->rx_overrun), 1);
}
if (status & STM32_USART_SR_RXNE) {
uint8_t byte = STM32_USART_RDR(base);
if (!queue_add_unit(config->producer.queue, &byte))
- deprecated_atomic_add(&config->state->rx_dropped, 1);
+ atomic_add((uint32_t *)&(config->state->rx_dropped), 1);
}
}
diff --git a/chip/stm32/usart_rx_interrupt.c b/chip/stm32/usart_rx_interrupt.c
index 3cbf1f49f4..3bc30d4aaf 100644
--- a/chip/stm32/usart_rx_interrupt.c
+++ b/chip/stm32/usart_rx_interrupt.c
@@ -30,7 +30,7 @@ static void usart_rx_interrupt_handler(struct usart_config const *config)
uint8_t byte = STM32_USART_RDR(base);
if (!queue_add_unit(config->producer.queue, &byte))
- deprecated_atomic_add(&config->state->rx_dropped, 1);
+ atomic_add((uint32_t *)&(config->state->rx_dropped), 1);
}
}
diff --git a/chip/stm32/usb.c b/chip/stm32/usb.c
index 1711480d53..f6e1daa8a5 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 (!deprecated_atomic_read_clear(&usb_wake_done))
+ if (!atomic_read_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 c206f9a9c5..f12796257c 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 (deprecated_atomic_read_clear(&hid_ep_data_ready)) {
+ if (atomic_read_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/button.c b/common/button.c
index 6f346ec7cb..a7908908b4 100644
--- a/common/button.c
+++ b/common/button.c
@@ -387,9 +387,8 @@ static void simulate_button_release_deferred(void)
/* Check state for button pressed */
if (sim_button_state & BIT(buttons[button_idx].type)) {
/* Set state of the button as released */
- deprecated_atomic_clear_bits(
- &sim_button_state,
- BIT(buttons[button_idx].type));
+ atomic_clear_bits(&sim_button_state,
+ BIT(buttons[button_idx].type));
button_interrupt_simulate(button_idx);
}
@@ -405,8 +404,8 @@ static void simulate_button(uint32_t button_mask, int press_ms)
for (button_idx = 0; button_idx < BUTTON_COUNT; button_idx++) {
if (button_mask & BIT(button_idx)) {
/* Set state of the button as pressed */
- deprecated_atomic_or(&sim_button_state,
- BIT(buttons[button_idx].type));
+ atomic_or(&sim_button_state,
+ BIT(buttons[button_idx].type));
button_interrupt_simulate(button_idx);
}
diff --git a/common/charge_manager.c b/common/charge_manager.c
index bc82859e5d..e3c2f52620 100644
--- a/common/charge_manager.c
+++ b/common/charge_manager.c
@@ -1248,9 +1248,9 @@ void charge_manager_source_port(int port, int enable)
int p, rp;
if (enable)
- deprecated_atomic_or(&source_port_bitmap, 1 << port);
+ atomic_or((uint32_t *)&source_port_bitmap, 1 << port);
else
- deprecated_atomic_clear_bits(&source_port_bitmap, 1 << port);
+ atomic_clear_bits((uint32_t *)&source_port_bitmap, 1 << port);
/* No change, exit early. */
if (prev_bitmap == source_port_bitmap)
diff --git a/common/device_event.c b/common/device_event.c
index 3b1fae79d0..ca13a58574 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 deprecated_atomic_read_clear(&device_current_events);
+ return atomic_read_clear(&device_current_events);
}
static uint32_t device_get_enabled_events(void)
@@ -43,7 +43,7 @@ void device_set_events(uint32_t mask)
if ((device_current_events & mask) != mask)
CPRINTS("device event set 0x%08x", mask);
- deprecated_atomic_or(&device_current_events, mask);
+ atomic_or(&device_current_events, mask);
/* Signal host that a device event is pending */
host_set_single_event(EC_HOST_EVENT_DEVICE);
@@ -55,7 +55,7 @@ void device_clear_events(uint32_t mask)
if (device_current_events & mask)
CPRINTS("device event clear 0x%08x", mask);
- deprecated_atomic_clear_bits(&device_current_events, mask);
+ atomic_clear_bits(&device_current_events, mask);
}
static void device_set_enabled_events(uint32_t mask)
diff --git a/common/dptf.c b/common/dptf.c
index f4fc6d0ff6..2a2cef0c17 100644
--- a/common/dptf.c
+++ b/common/dptf.c
@@ -47,7 +47,7 @@ int dptf_query_next_sensor_event(void)
for (id = 0; id < TEMP_SENSOR_COUNT; id++)
if (dptf_seen & BIT(id)) { /* atomic? */
- deprecated_atomic_clear_bits(&dptf_seen, BIT(id));
+ atomic_clear_bits(&dptf_seen, BIT(id));
return id;
}
@@ -79,13 +79,13 @@ static int dptf_check_temp_threshold(int sensor_id, int temp)
if (cond_went_true(&dptf_threshold[sensor_id][i].over)) {
CPRINTS("DPTF over threshold [%d][%d",
sensor_id, i);
- deprecated_atomic_or(&dptf_seen, BIT(sensor_id));
+ atomic_or(&dptf_seen, BIT(sensor_id));
tripped = 1;
}
if (cond_went_false(&dptf_threshold[sensor_id][i].over)) {
CPRINTS("DPTF under threshold [%d][%d",
sensor_id, i);
- deprecated_atomic_or(&dptf_seen, BIT(sensor_id));
+ atomic_or(&dptf_seen, BIT(sensor_id));
tripped = 1;
}
}
@@ -109,7 +109,7 @@ void dptf_set_temp_threshold(int sensor_id, int temp, int idx, int enable)
if (dptf_threshold[sensor_id][idx].temp == -1)
cond_init(&dptf_threshold[sensor_id][idx].over, 0);
dptf_threshold[sensor_id][idx].temp = temp;
- deprecated_atomic_clear_bits(&dptf_seen, BIT(sensor_id));
+ atomic_clear_bits(&dptf_seen, BIT(sensor_id));
} else {
dptf_threshold[sensor_id][idx].temp = -1;
}
diff --git a/common/fpsensor/fpsensor.c b/common/fpsensor/fpsensor.c
index 5611fd828d..2965b52fe9 100644
--- a/common/fpsensor/fpsensor.c
+++ b/common/fpsensor/fpsensor.c
@@ -64,7 +64,7 @@ void fps_event(enum gpio_signal signal)
static void send_mkbp_event(uint32_t event)
{
- deprecated_atomic_or(&fp_events, event);
+ atomic_or(&fp_events, event);
mkbp_send_event(EC_MKBP_EVENT_FINGERPRINT);
}
@@ -783,7 +783,7 @@ int command_fpenroll(int argc, char **argv)
FP_MODE_ENROLL_IMAGE);
if (rc != EC_SUCCESS)
break;
- event = deprecated_atomic_read_clear(&fp_events);
+ event = atomic_read_clear(&fp_events);
percent = EC_MKBP_FP_ENROLL_PROGRESS(event);
CPRINTS("Enroll capture: %s (%d%%)",
enroll_str[EC_MKBP_FP_ERRCODE(event) & 3], percent);
@@ -806,7 +806,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 = deprecated_atomic_read_clear(&fp_events);
+ uint32_t event = atomic_read_clear(&fp_events);
if (rc == EC_SUCCESS && event & EC_MKBP_FP_MATCH) {
uint32_t errcode = EC_MKBP_FP_ERRCODE(event);
@@ -832,7 +832,7 @@ int command_fpclear(int argc, char **argv)
if (rc < 0)
CPRINTS("Failed to clear fingerprint context: %d", rc);
- deprecated_atomic_read_clear(&fp_events);
+ atomic_read_clear(&fp_events);
return rc;
}
diff --git a/common/fpsensor/fpsensor_state.c b/common/fpsensor/fpsensor_state.c
index 82fa4f23a1..ec4ddb4fd9 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 = deprecated_atomic_read_clear(&fp_events);
+ uint32_t event_out = atomic_read_clear(&fp_events);
memcpy(out, &event_out, sizeof(event_out));
diff --git a/common/host_event_commands.c b/common/host_event_commands.c
index 9ab7f19d04..665a268ec4 100644
--- a/common/host_event_commands.c
+++ b/common/host_event_commands.c
@@ -266,9 +266,9 @@ static void host_events_atomic_or(host_event_t *e, host_event_t m)
{
uint32_t *ptr = (uint32_t *)e;
- deprecated_atomic_or(ptr, (uint32_t)m);
+ atomic_or(ptr, (uint32_t)m);
#ifdef CONFIG_HOST_EVENT64
- deprecated_atomic_or(ptr + 1, (uint32_t)(m >> 32));
+ atomic_or(ptr + 1, (uint32_t)(m >> 32));
#endif
}
@@ -276,9 +276,9 @@ static void host_events_atomic_clear(host_event_t *e, host_event_t m)
{
uint32_t *ptr = (uint32_t *)e;
- deprecated_atomic_clear_bits(ptr, (uint32_t)m);
+ atomic_clear_bits(ptr, (uint32_t)m);
#ifdef CONFIG_HOST_EVENT64
- deprecated_atomic_clear_bits(ptr + 1, (uint32_t)(m >> 32));
+ atomic_clear_bits(ptr + 1, (uint32_t)(m >> 32));
#endif
}
diff --git a/common/keyboard_mkbp.c b/common/keyboard_mkbp.c
index 9b41ef593e..45cd50f4f5 100644
--- a/common/keyboard_mkbp.c
+++ b/common/keyboard_mkbp.c
@@ -153,7 +153,7 @@ static int fifo_remove(uint8_t *buffp)
}
fifo_start = (fifo_start + 1) % FIFO_DEPTH;
- deprecated_atomic_sub(&fifo_entries, 1);
+ atomic_sub(&fifo_entries, 1);
mutex_unlock(&fifo_remove_mutex);
return EC_SUCCESS;
@@ -250,7 +250,7 @@ test_mockable int mkbp_fifo_add(uint8_t event_type, const uint8_t *buffp)
fifo[fifo_end].event_type = event_type;
memcpy(&fifo[fifo_end].data, buffp, size);
fifo_end = (fifo_end + 1) % FIFO_DEPTH;
- deprecated_atomic_add(&fifo_entries, 1);
+ atomic_add(&fifo_entries, 1);
/*
* If our event didn't generate an interrupt then the host is still
diff --git a/common/keyboard_scan.c b/common/keyboard_scan.c
index 0e95eb6c34..eae7f90118 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -143,10 +143,9 @@ void keyboard_scan_enable(int enable, enum kb_scan_disable_masks mask)
{
/* Access atomically */
if (enable) {
- deprecated_atomic_clear_bits((uint32_t *)&disable_scanning_mask,
- mask);
+ atomic_clear_bits((uint32_t *)&disable_scanning_mask, mask);
} else {
- deprecated_atomic_or((uint32_t *)&disable_scanning_mask, mask);
+ atomic_or((uint32_t *)&disable_scanning_mask, mask);
clear_typematic_key();
}
diff --git a/common/motion_sense.c b/common/motion_sense.c
index a283ce7346..6feed6738d 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -677,12 +677,11 @@ 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 =
- deprecated_atomic_read_clear(&odr_event_required);
+ int odr_pending = atomic_read_clear(&odr_event_required);
is_odr_pending = odr_pending & sensor_bit;
odr_pending &= ~sensor_bit;
- deprecated_atomic_or(&odr_event_required, odr_pending);
+ atomic_or(&odr_event_required, odr_pending);
}
#ifdef CONFIG_ACCEL_INTERRUPTS
@@ -708,8 +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 =
- deprecated_atomic_read_clear(&sensor->flush_pending);
+ int flush_pending = atomic_read_clear(&sensor->flush_pending);
for (; flush_pending > 0; flush_pending--) {
motion_sense_fifo_insert_async_event(
@@ -1172,8 +1170,8 @@ static enum ec_status host_cmd_motion_sense(struct host_cmd_handler_args *args)
* The new ODR may suspend sensor, leaving samples
* in the FIFO. Flush it explicitly.
*/
- deprecated_atomic_or(&odr_event_required,
- 1 << (sensor - motion_sensors));
+ atomic_or(&odr_event_required,
+ 1 << (sensor - motion_sensors));
task_set_event(TASK_ID_MOTIONSENSE,
TASK_EVENT_MOTION_ODR_CHANGE, 0);
}
@@ -1294,7 +1292,7 @@ static enum ec_status host_cmd_motion_sense(struct host_cmd_handler_args *args)
if (sensor == NULL)
return EC_RES_INVALID_PARAM;
- deprecated_atomic_add(&sensor->flush_pending, 1);
+ atomic_add(&sensor->flush_pending, 1);
task_set_event(TASK_ID_MOTIONSENSE,
TASK_EVENT_MOTION_FLUSH_PENDING, 0);
@@ -1645,8 +1643,7 @@ static int command_accel_data_rate(int argc, char **argv)
sensor->config[config_id].odr =
data | (round ? ROUND_UP_FLAG : 0);
- deprecated_atomic_or(&odr_event_required,
- 1 << (sensor - motion_sensors));
+ atomic_or(&odr_event_required, 1 << (sensor - motion_sensors));
task_set_event(TASK_ID_MOTIONSENSE,
TASK_EVENT_MOTION_ODR_CHANGE, 0);
} else {
diff --git a/common/timer.c b/common/timer.c
index c359efb541..7b6cd0b5f5 100644
--- a/common/timer.c
+++ b/common/timer.c
@@ -41,7 +41,7 @@ static int timer_irq;
static void expire_timer(task_id_t tskid)
{
/* we are done with this timer */
- deprecated_atomic_clear_bits(&timer_running, 1 << tskid);
+ atomic_clear_bits(&timer_running, 1 << tskid);
/* wake up the taks waiting for this timer */
task_set_event(tskid, TASK_EVENT_TIMER, 0);
}
@@ -132,7 +132,7 @@ int timer_arm(timestamp_t event, task_id_t tskid)
return EC_ERROR_BUSY;
timer_deadline[tskid] = event;
- deprecated_atomic_or(&timer_running, BIT(tskid));
+ atomic_or(&timer_running, BIT(tskid));
/* Modify the next event if needed */
if ((event.le.hi < now.le.hi) ||
@@ -146,7 +146,7 @@ void timer_cancel(task_id_t tskid)
{
ASSERT(tskid < TASK_ID_COUNT);
- deprecated_atomic_clear_bits(&timer_running, BIT(tskid));
+ atomic_clear_bits(&timer_running, BIT(tskid));
/*
* Don't need to cancel the hardware timer interrupt, instead do
* timer-related housekeeping when the next timer interrupt fires.
@@ -186,8 +186,8 @@ void usleep(unsigned us)
/* Re-queue other events which happened in the meanwhile */
if (evt)
- deprecated_atomic_or(task_get_event_bitmap(task_get_current()),
- evt & ~TASK_EVENT_TIMER);
+ atomic_or(task_get_event_bitmap(task_get_current()),
+ evt & ~TASK_EVENT_TIMER);
}
timestamp_t get_time(void)
diff --git a/common/usb_common.c b/common/usb_common.c
index d2a5e43cdb..7053607433 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 = deprecated_atomic_read_clear(&port_oc_reset_req);
+ uint32_t ports = atomic_read_clear(&port_oc_reset_req);
while (ports) {
int port = __fls(ports);
@@ -510,7 +510,7 @@ void pd_handle_overcurrent(int port)
board_overcurrent_event(port, 1);
/* Wait 1s before trying to re-enable the port. */
- deprecated_atomic_or(&port_oc_reset_req, BIT(port));
+ atomic_or(&port_oc_reset_req, BIT(port));
hook_call_deferred(&re_enable_ports_data, SECOND);
}
@@ -747,8 +747,7 @@ static uint32_t pd_ports_to_resume;
static void resume_pd_port(void)
{
uint32_t port;
- uint32_t suspended_ports =
- deprecated_atomic_read_clear(&pd_ports_to_resume);
+ uint32_t suspended_ports = atomic_read_clear(&pd_ports_to_resume);
while (suspended_ports) {
port = __builtin_ctz(suspended_ports);
@@ -760,7 +759,7 @@ DECLARE_DEFERRED(resume_pd_port);
void pd_deferred_resume(int port)
{
- deprecated_atomic_or(&pd_ports_to_resume, 1 << port);
+ atomic_or(&pd_ports_to_resume, 1 << port);
hook_call_deferred(&resume_pd_port_data, 5 * SECOND);
}
#endif /* CONFIG_USB_PD_TCPM_TCPCI */
diff --git a/common/usb_pd_host_cmd.c b/common/usb_pd_host_cmd.c
index 8bdc50a0e3..19e74b47aa 100644
--- a/common/usb_pd_host_cmd.c
+++ b/common/usb_pd_host_cmd.c
@@ -608,7 +608,7 @@ DECLARE_HOST_COMMAND(EC_CMD_PD_CONTROL, pd_control, EC_VER_MASK(0));
/*
* PD host event status for host command
* Note: this variable must be aligned on 4-byte boundary because we pass the
- * address to deprecated_atomic_ functions which use assembly to access them.
+ * address to atomic_ functions which use assembly to access them.
*/
static uint32_t pd_host_event_status __aligned(4);
@@ -618,7 +618,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 = deprecated_atomic_read_clear(&pd_host_event_status);
+ r->status = atomic_read_clear(&pd_host_event_status);
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;
@@ -633,7 +633,7 @@ void pd_send_host_event(int mask)
if (!mask)
return;
- deprecated_atomic_or(&pd_host_event_status, mask);
+ atomic_or(&pd_host_event_status, mask);
/* interrupt the AP */
host_set_single_event(EC_HOST_EVENT_PD_MCU);
}
diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c
index fe125aa5db..be17b187e8 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -531,11 +531,10 @@ static int reset_device_and_notify(int port)
* waking the TCPC, but it has also set PD_EVENT_TCPC_RESET again, which
* would result in a second, unnecessary init.
*/
- deprecated_atomic_clear_bits(task_get_event_bitmap(task_get_current()),
- PD_EVENT_TCPC_RESET);
+ atomic_clear_bits(task_get_event_bitmap(task_get_current()),
+ PD_EVENT_TCPC_RESET);
- waiting_tasks =
- deprecated_atomic_read_clear(&pd[port].tasks_waiting_on_reset);
+ waiting_tasks = atomic_read_clear(&pd[port].tasks_waiting_on_reset);
/*
* Now that we are done waking up the device, handle device access
@@ -563,8 +562,8 @@ static void pd_wait_for_wakeup(int port)
reset_device_and_notify(port);
} else {
/* Otherwise, we need to wait for the TCPC reset to complete */
- deprecated_atomic_or(&pd[port].tasks_waiting_on_reset,
- 1 << task_get_current());
+ atomic_or(&pd[port].tasks_waiting_on_reset,
+ 1 << task_get_current());
/*
* NOTE: We could be sending the PD task the reset event while
* it is already processing the reset event. If that occurs,
@@ -608,11 +607,10 @@ void pd_prevent_low_power_mode(int port, int prevent)
const int current_task_mask = (1 << task_get_current());
if (prevent)
- deprecated_atomic_or(&pd[port].tasks_preventing_lpm,
- current_task_mask);
+ atomic_or(&pd[port].tasks_preventing_lpm, current_task_mask);
else
- deprecated_atomic_clear_bits(&pd[port].tasks_preventing_lpm,
- current_task_mask);
+ atomic_clear_bits(&pd[port].tasks_preventing_lpm,
+ current_task_mask);
}
/* This is only called from the PD tasks that owns the port. */
diff --git a/common/usbc/usb_pe_drp_sm.c b/common/usbc/usb_pe_drp_sm.c
index 655bae4599..123cd07a81 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -63,20 +63,17 @@
#define CPRINTS_L2(format, args...) CPRINTS_LX(2, format, ## args)
#define CPRINTS_L3(format, args...) CPRINTS_LX(3, format, ## args)
-
-#define PE_SET_FLAG(port, flag) deprecated_atomic_or(&pe[port].flags, (flag))
-#define PE_CLR_FLAG(port, flag) \
- deprecated_atomic_clear_bits(&pe[port].flags, (flag))
+#define PE_SET_FLAG(port, flag) atomic_or(&pe[port].flags, (flag))
+#define PE_CLR_FLAG(port, flag) atomic_clear_bits(&pe[port].flags, (flag))
#define PE_CHK_FLAG(port, flag) (pe[port].flags & (flag))
/*
* These macros SET, CLEAR, and CHECK, a DPM (Device Policy Manager)
* Request. The Requests are listed in usb_pe_sm.h.
*/
-#define PE_SET_DPM_REQUEST(port, req) \
- deprecated_atomic_or(&pe[port].dpm_request, (req))
+#define PE_SET_DPM_REQUEST(port, req) atomic_or(&pe[port].dpm_request, (req))
#define PE_CLR_DPM_REQUEST(port, req) \
- deprecated_atomic_clear_bits(&pe[port].dpm_request, (req))
+ atomic_clear_bits(&pe[port].dpm_request, (req))
#define PE_CHK_DPM_REQUEST(port, req) (pe[port].dpm_request & (req))
/*
@@ -1029,7 +1026,7 @@ void pe_notify_event(int port, uint32_t event_mask)
/* Events may only be set from the PD task */
assert(port == TASK_ID_TO_PD_PORT(task_get_current()));
- deprecated_atomic_or(&pe[port].events, event_mask);
+ atomic_or(&pe[port].events, event_mask);
/* Notify the host that new events are available to read */
pd_send_host_event(PD_EVENT_TYPEC);
@@ -1037,7 +1034,7 @@ void pe_notify_event(int port, uint32_t event_mask)
void pd_clear_events(int port, uint32_t clear_mask)
{
- deprecated_atomic_clear_bits(&pe[port].events, clear_mask);
+ atomic_clear_bits(&pe[port].events, clear_mask);
}
uint32_t pd_get_events(int port)
@@ -6193,10 +6190,9 @@ void pd_dfp_discovery_init(int port)
PE_CLR_FLAG(port, PE_FLAGS_VDM_SETUP_DONE |
PE_FLAGS_MODAL_OPERATION);
- deprecated_atomic_or(&task_access[port][TCPC_TX_SOP],
- BIT(task_get_current()));
- deprecated_atomic_or(&task_access[port][TCPC_TX_SOP_PRIME],
- BIT(task_get_current()));
+ atomic_or(&task_access[port][TCPC_TX_SOP], BIT(task_get_current()));
+ atomic_or(&task_access[port][TCPC_TX_SOP_PRIME],
+ BIT(task_get_current()));
memset(pe[port].discovery, 0, sizeof(pe[port].discovery));
memset(pe[port].partner_amodes, 0, sizeof(pe[port].partner_amodes));
@@ -6216,7 +6212,7 @@ void pd_dfp_discovery_init(int port)
void pd_discovery_access_clear(int port, enum tcpm_transmit_type type)
{
- deprecated_atomic_clear_bits(&task_access[port][type], 0xFFFFFFFF);
+ atomic_clear_bits(&task_access[port][type], 0xFFFFFFFF);
}
bool pd_discovery_access_validate(int port, enum tcpm_transmit_type type)
@@ -6228,7 +6224,7 @@ struct pd_discovery *pd_get_am_discovery(int port, enum tcpm_transmit_type type)
{
ASSERT(type < DISCOVERY_TYPE_COUNT);
- deprecated_atomic_or(&task_access[port][type], BIT(task_get_current()));
+ atomic_or(&task_access[port][type], BIT(task_get_current()));
return &pe[port].discovery[type];
}
diff --git a/common/usbc/usb_prl_sm.c b/common/usbc/usb_prl_sm.c
index 69861fb482..4817d4e76f 100644
--- a/common/usbc/usb_prl_sm.c
+++ b/common/usbc/usb_prl_sm.c
@@ -40,32 +40,26 @@
#define CPRINTS(format, args...)
#endif
-#define RCH_SET_FLAG(port, flag) deprecated_atomic_or(&rch[port].flags, (flag))
-#define RCH_CLR_FLAG(port, flag) \
- deprecated_atomic_clear_bits(&rch[port].flags, (flag))
+#define RCH_SET_FLAG(port, flag) atomic_or(&rch[port].flags, (flag))
+#define RCH_CLR_FLAG(port, flag) atomic_clear_bits(&rch[port].flags, (flag))
#define RCH_CHK_FLAG(port, flag) (rch[port].flags & (flag))
-#define TCH_SET_FLAG(port, flag) deprecated_atomic_or(&tch[port].flags, (flag))
-#define TCH_CLR_FLAG(port, flag) \
- deprecated_atomic_clear_bits(&tch[port].flags, (flag))
+#define TCH_SET_FLAG(port, flag) atomic_or(&tch[port].flags, (flag))
+#define TCH_CLR_FLAG(port, flag) atomic_clear_bits(&tch[port].flags, (flag))
#define TCH_CHK_FLAG(port, flag) (tch[port].flags & (flag))
-#define PRL_TX_SET_FLAG(port, flag) \
- deprecated_atomic_or(&prl_tx[port].flags, (flag))
+#define PRL_TX_SET_FLAG(port, flag) atomic_or(&prl_tx[port].flags, (flag))
#define PRL_TX_CLR_FLAG(port, flag) \
- deprecated_atomic_clear_bits(&prl_tx[port].flags, (flag))
+ atomic_clear_bits(&prl_tx[port].flags, (flag))
#define PRL_TX_CHK_FLAG(port, flag) (prl_tx[port].flags & (flag))
-#define PRL_HR_SET_FLAG(port, flag) \
- deprecated_atomic_or(&prl_hr[port].flags, (flag))
+#define PRL_HR_SET_FLAG(port, flag) atomic_or(&prl_hr[port].flags, (flag))
#define PRL_HR_CLR_FLAG(port, flag) \
- deprecated_atomic_clear_bits(&prl_hr[port].flags, (flag))
+ atomic_clear_bits(&prl_hr[port].flags, (flag))
#define PRL_HR_CHK_FLAG(port, flag) (prl_hr[port].flags & (flag))
-#define PDMSG_SET_FLAG(port, flag) \
- deprecated_atomic_or(&pdmsg[port].flags, (flag))
-#define PDMSG_CLR_FLAG(port, flag) \
- deprecated_atomic_clear_bits(&pdmsg[port].flags, (flag))
+#define PDMSG_SET_FLAG(port, flag) atomic_or(&pdmsg[port].flags, (flag))
+#define PDMSG_CLR_FLAG(port, flag) atomic_clear_bits(&pdmsg[port].flags, (flag))
#define PDMSG_CHK_FLAG(port, flag) (pdmsg[port].flags & (flag))
/* Protocol Layer Flags */
diff --git a/common/usbc/usb_tc_drp_acc_trysrc_sm.c b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
index 3382c3b84c..5a0d6ed3fd 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -60,20 +60,19 @@
#ifdef DEBUG_PRINT_FLAG_AND_EVENT_NAMES
void print_flag(int set_or_clear, int flag);
-#define TC_SET_FLAG(port, flag) \
- do { \
- print_flag(1, flag); \
- deprecated_atomic_or(&tc[port].flags, (flag)); \
+#define TC_SET_FLAG(port, flag) \
+ do { \
+ print_flag(1, flag); \
+ atomic_or(&tc[port].flags, (flag)); \
} while (0)
-#define TC_CLR_FLAG(port, flag) \
- do { \
- print_flag(0, flag); \
- deprecated_atomic_clear_bits(&tc[port].flags, (flag)); \
+#define TC_CLR_FLAG(port, flag) \
+ do { \
+ print_flag(0, flag); \
+ atomic_clear_bits(&tc[port].flags, (flag)); \
} while (0)
#else
-#define TC_SET_FLAG(port, flag) deprecated_atomic_or(&tc[port].flags, (flag))
-#define TC_CLR_FLAG(port, flag) \
- deprecated_atomic_clear_bits(&tc[port].flags, (flag))
+#define TC_SET_FLAG(port, flag) atomic_or(&tc[port].flags, (flag))
+#define TC_CLR_FLAG(port, flag) atomic_clear_bits(&tc[port].flags, (flag))
#endif
#define TC_CHK_FLAG(port, flag) (tc[port].flags & (flag))
@@ -632,11 +631,10 @@ static bool pd_comm_allowed_by_policy(void)
static void tc_policy_pd_enable(int port, int en)
{
if (en)
- deprecated_atomic_clear_bits(&tc[port].pd_disabled_mask,
- PD_DISABLED_BY_POLICY);
+ atomic_clear_bits(&tc[port].pd_disabled_mask,
+ PD_DISABLED_BY_POLICY);
else
- deprecated_atomic_or(&tc[port].pd_disabled_mask,
- PD_DISABLED_BY_POLICY);
+ atomic_or(&tc[port].pd_disabled_mask, PD_DISABLED_BY_POLICY);
CPRINTS("C%d: PD comm policy %sabled", port, en ? "en" : "dis");
}
@@ -644,20 +642,20 @@ static void tc_policy_pd_enable(int port, int en)
static void tc_enable_pd(int port, int en)
{
if (en)
- deprecated_atomic_clear_bits(&tc[port].pd_disabled_mask,
- PD_DISABLED_NO_CONNECTION);
+ atomic_clear_bits(&tc[port].pd_disabled_mask,
+ PD_DISABLED_NO_CONNECTION);
else
- deprecated_atomic_or(&tc[port].pd_disabled_mask,
- PD_DISABLED_NO_CONNECTION);
+ atomic_or(&tc[port].pd_disabled_mask,
+ PD_DISABLED_NO_CONNECTION);
}
#ifdef CONFIG_USB_PD_TRY_SRC
static void tc_enable_try_src(int en)
{
if (en)
- deprecated_atomic_or(&pd_try_src, 1);
+ atomic_or(&pd_try_src, 1);
else
- deprecated_atomic_clear_bits(&pd_try_src, 1);
+ atomic_clear_bits(&pd_try_src, 1);
}
#endif
@@ -1777,11 +1775,10 @@ static __maybe_unused int reset_device_and_notify(int port)
* waking the TCPC, but it has also set PD_EVENT_TCPC_RESET again, which
* would result in a second, unnecessary init.
*/
- deprecated_atomic_clear_bits(task_get_event_bitmap(task_get_current()),
- PD_EVENT_TCPC_RESET);
+ atomic_clear_bits(task_get_event_bitmap(task_get_current()),
+ PD_EVENT_TCPC_RESET);
- waiting_tasks =
- deprecated_atomic_read_clear(&tc[port].tasks_waiting_on_reset);
+ waiting_tasks = atomic_read_clear(&tc[port].tasks_waiting_on_reset);
/* Wake up all waiting tasks. */
while (waiting_tasks) {
@@ -1804,8 +1801,8 @@ void pd_wait_exit_low_power(int port)
reset_device_and_notify(port);
} else {
/* Otherwise, we need to wait for the TCPC reset to complete */
- deprecated_atomic_or(&tc[port].tasks_waiting_on_reset,
- 1 << task_get_current());
+ atomic_or(&tc[port].tasks_waiting_on_reset,
+ 1 << task_get_current());
/*
* NOTE: We could be sending the PD task the reset event while
* it is already processing the reset event. If that occurs,
@@ -1845,11 +1842,10 @@ void pd_prevent_low_power_mode(int port, int prevent)
return;
if (prevent)
- deprecated_atomic_or(&tc[port].tasks_preventing_lpm,
- current_task_mask);
+ atomic_or(&tc[port].tasks_preventing_lpm, current_task_mask);
else
- deprecated_atomic_clear_bits(&tc[port].tasks_preventing_lpm,
- current_task_mask);
+ atomic_clear_bits(&tc[port].tasks_preventing_lpm,
+ current_task_mask);
}
#endif /* CONFIG_USB_PD_TCPC_LOW_POWER */
diff --git a/common/usbc_ppc.c b/common/usbc_ppc.c
index 6724d75abf..73dbf9d1c0 100644
--- a/common/usbc_ppc.c
+++ b/common/usbc_ppc.c
@@ -84,7 +84,7 @@ int ppc_add_oc_event(int port)
oc_event_cnt_tbl[port]++;
/* The port overcurrented, so don't clear it's OC events. */
- deprecated_atomic_clear_bits(&snk_connected_ports, 1 << port);
+ atomic_clear_bits(&snk_connected_ports, 1 << port);
if (oc_event_cnt_tbl[port] >= PPC_OC_CNT_THRESH)
ppc_prints("OC event limit reached! "
@@ -269,10 +269,10 @@ int ppc_dev_is_connected(int port, enum ppc_device_role dev)
}
if (dev == PPC_DEV_SNK)
- deprecated_atomic_or(&snk_connected_ports, 1 << port);
+ atomic_or(&snk_connected_ports, 1 << port);
else
/* clear flag if it transitions to SRC or disconnected */
- deprecated_atomic_clear_bits(&snk_connected_ports, 1 << port);
+ atomic_clear_bits(&snk_connected_ports, 1 << port);
ppc = &ppc_chips[port];
if (ppc->drv->dev_is_connected)
diff --git a/core/cortex-m/task.c b/core/cortex-m/task.c
index 510d18fca0..9c3068bbc0 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 = deprecated_atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_read_clear(&tsk->events))) {
/* Remove ourself and get the next task in the scheduler */
__schedule(1, resched);
resched = TASK_ID_IDLE;
@@ -421,7 +421,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
if (timeout_us > 0) {
timer_cancel(me);
/* Ensure timer event is clear, we no longer care about it */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
}
return evt;
}
@@ -432,12 +432,12 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
ASSERT(receiver);
/* Set the event bit in the receiver message bitmap */
- deprecated_atomic_or(&receiver->events, event);
+ atomic_or(&receiver->events, event);
/* Re-schedule if priorities have changed */
if (in_interrupt_context()) {
/* The receiver might run again */
- deprecated_atomic_or(&tasks_ready, 1 << tskid);
+ atomic_or(&tasks_ready, 1 << tskid);
#ifndef CONFIG_TASK_PROFILING
if (start_called)
need_resched_or_profiling = 1;
@@ -480,8 +480,7 @@ uint32_t task_wait_event_mask(uint32_t event_mask, int timeout_us)
/* Re-post any other events collected */
if (events & ~event_mask)
- deprecated_atomic_or(&current_task->events,
- events & ~event_mask);
+ atomic_or(&current_task->events, events & ~event_mask);
return events & event_mask;
}
@@ -496,12 +495,12 @@ void task_enable_all_tasks(void)
void task_enable_task(task_id_t tskid)
{
- deprecated_atomic_or(&tasks_enabled, BIT(tskid));
+ atomic_or(&tasks_enabled, BIT(tskid));
}
void task_disable_task(task_id_t tskid)
{
- deprecated_atomic_clear_bits(&tasks_enabled, BIT(tskid));
+ atomic_clear_bits(&tasks_enabled, BIT(tskid));
if (!in_interrupt_context() && tskid == task_get_current())
__schedule(0, 0);
@@ -579,8 +578,7 @@ static void deferred_task_reset(void)
while (deferred_reset_task_ids) {
task_id_t reset_id = __fls(deferred_reset_task_ids);
- deprecated_atomic_clear_bits(&deferred_reset_task_ids,
- 1 << reset_id);
+ atomic_clear_bits(&deferred_reset_task_ids, 1 << reset_id);
do_task_reset(reset_id);
}
}
@@ -675,7 +673,7 @@ void task_enable_resets(void)
return;
/* People are waiting for us to reset; schedule a reset. */
- deprecated_atomic_or(&deferred_reset_task_ids, 1 << id);
+ atomic_or(&deferred_reset_task_ids, 1 << id);
/*
* This will always trigger a deferred call after our new ID was
* written. If the hook call is currently executing, it will run
@@ -760,7 +758,7 @@ int task_reset_cleanup(void)
* itself back to the list of tasks to notify,
* and we will notify it again.
*/
- deprecated_atomic_clear_bits(state, 1 << notify_id);
+ atomic_clear_bits(state, 1 << notify_id);
/*
* Skip any invalid ids set by tasks that
* requested a non-blocking reset.
@@ -878,7 +876,7 @@ void mutex_lock(struct mutex *mtx)
id = 1 << task_get_current();
- deprecated_atomic_or(&mtx->waiters, id);
+ atomic_or(&mtx->waiters, id);
do {
/* Try to get the lock (set 1 into the lock field) */
@@ -897,7 +895,7 @@ void mutex_lock(struct mutex *mtx)
task_wait_event_mask(TASK_EVENT_MUTEX, 0);
} while (value);
- deprecated_atomic_clear_bits(&mtx->waiters, id);
+ atomic_clear_bits(&mtx->waiters, id);
}
void mutex_unlock(struct mutex *mtx)
@@ -923,7 +921,7 @@ void mutex_unlock(struct mutex *mtx)
}
/* Ensure no event is remaining from mutex wake-up */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
}
void task_print_list(void)
diff --git a/core/cortex-m0/task.c b/core/cortex-m0/task.c
index 3e54630ab2..d8ed4a6376 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 = deprecated_atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_read_clear(&tsk->events))) {
/*
* We need to ensure that the execution priority is actually
* decreased after the "cpsie i" in the atomic operation above
@@ -349,7 +349,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
if (timeout_us > 0) {
timer_cancel(me);
/* Ensure timer event is clear, we no longer care about it */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
}
return evt;
}
@@ -360,12 +360,12 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
ASSERT(receiver);
/* Set the event bit in the receiver message bitmap */
- deprecated_atomic_or(&receiver->events, event);
+ atomic_or(&receiver->events, event);
/* Re-schedule if priorities have changed */
if (in_interrupt_context()) {
/* The receiver might run again */
- deprecated_atomic_or(&tasks_ready, 1 << tskid);
+ atomic_or(&tasks_ready, 1 << tskid);
if (start_called) {
/*
* Trigger the scheduler when there's
@@ -420,8 +420,7 @@ uint32_t task_wait_event_mask(uint32_t event_mask, int timeout_us)
/* Re-post any other events collected */
if (events & ~event_mask)
- deprecated_atomic_or(&current_task->events,
- events & ~event_mask);
+ atomic_or(&current_task->events, events & ~event_mask);
return events & event_mask;
}
@@ -436,12 +435,12 @@ void task_enable_all_tasks(void)
void task_enable_task(task_id_t tskid)
{
- deprecated_atomic_or(&tasks_enabled, BIT(tskid));
+ atomic_or(&tasks_enabled, BIT(tskid));
}
void task_disable_task(task_id_t tskid)
{
- deprecated_atomic_clear_bits(&tasks_enabled, BIT(tskid));
+ atomic_clear_bits(&tasks_enabled, BIT(tskid));
if (!in_interrupt_context() && tskid == task_get_current())
__schedule(0, 0);
@@ -500,7 +499,7 @@ void mutex_lock(struct mutex *mtx)
uint32_t id = 1 << task_get_current();
ASSERT(id != TASK_ID_INVALID);
- deprecated_atomic_or(&mtx->waiters, id);
+ atomic_or(&mtx->waiters, id);
while (1) {
/* Try to get the lock (set 2 into the lock field) */
@@ -514,7 +513,7 @@ void mutex_lock(struct mutex *mtx)
mtx->lock = 2;
__asm__ __volatile__("cpsie i");
- deprecated_atomic_clear_bits(&mtx->waiters, id);
+ atomic_clear_bits(&mtx->waiters, id);
}
void mutex_unlock(struct mutex *mtx)
@@ -540,7 +539,7 @@ void mutex_unlock(struct mutex *mtx)
}
/* Ensure no event is remaining from mutex wake-up */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
}
void task_print_list(void)
diff --git a/core/host/task.c b/core/host/task.c
index ae5e525303..e73f8c57fe 100644
--- a/core/host/task.c
+++ b/core/host/task.c
@@ -200,7 +200,7 @@ pthread_t task_get_thread(task_id_t tskid)
uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
{
- deprecated_atomic_or(&tasks[tskid].event, event);
+ atomic_or(&tasks[tskid].event, event);
if (wait)
return task_wait_event(-1);
return 0;
@@ -224,7 +224,7 @@ uint32_t task_wait_event(int timeout_us)
pthread_cond_wait(&tasks[tid].resume, &run_lock);
/* Resume */
- ret = deprecated_atomic_read_clear(&tasks[tid].event);
+ ret = atomic_read_clear(&tasks[tid].event);
pthread_mutex_unlock(&interrupt_lock);
return ret;
}
@@ -252,8 +252,8 @@ uint32_t task_wait_event_mask(uint32_t event_mask, int timeout_us)
/* Re-post any other events collected */
if (events & ~event_mask)
- deprecated_atomic_or(&tasks[task_get_current()].event,
- events & ~event_mask);
+ atomic_or(&tasks[task_get_current()].event,
+ events & ~event_mask);
return events & event_mask;
}
diff --git a/core/minute-ia/task.c b/core/minute-ia/task.c
index 431bd62e54..8a54772ada 100644
--- a/core/minute-ia/task.c
+++ b/core/minute-ia/task.c
@@ -287,7 +287,7 @@ void __keep task_start_irq_handler(void *data)
irq_dist[irq]++;
else
/* Track total number of service calls */
- deprecated_atomic_add(&svc_calls, 1);
+ atomic_add(&svc_calls, 1);
/* Only the outer ISR should keep track of the ISR start time */
if (__in_isr == 1) {
@@ -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 = deprecated_atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_read_clear(&tsk->events))) {
/* Remove ourself and get the next task in the scheduler */
__schedule(1, resched);
resched = TASK_ID_IDLE;
@@ -326,7 +326,7 @@ static uint32_t __wait_evt(int timeout_us, task_id_t resched)
if (timeout_us > 0) {
timer_cancel(me);
/* Ensure timer event is clear, we no longer care about it */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
}
return evt;
}
@@ -345,12 +345,12 @@ uint32_t task_set_event(task_id_t tskid, uint32_t event, int wait)
ASSERT(receiver);
/* Set the event bit in the receiver message bitmap */
- deprecated_atomic_or(&receiver->events, event);
+ atomic_or(&receiver->events, event);
/* Re-schedule if priorities have changed */
if (in_interrupt_context()) {
/* The receiver might run again */
- deprecated_atomic_or(&tasks_ready, 1 << tskid);
+ atomic_or(&tasks_ready, 1 << tskid);
} else {
if (wait)
return __wait_evt(-1, tskid);
@@ -389,8 +389,7 @@ uint32_t task_wait_event_mask(uint32_t event_mask, int timeout_us)
/* Re-post any other events collected */
if (events & ~event_mask)
- deprecated_atomic_or(&current_task->events,
- events & ~event_mask);
+ atomic_or(&current_task->events, events & ~event_mask);
return events & event_mask;
}
@@ -406,12 +405,12 @@ void task_enable_all_tasks(void)
void task_enable_task(task_id_t tskid)
{
- deprecated_atomic_or(&tasks_enabled, BIT(tskid));
+ atomic_or(&tasks_enabled, BIT(tskid));
}
void task_disable_task(task_id_t tskid)
{
- deprecated_atomic_clear_bits(&tasks_enabled, BIT(tskid));
+ atomic_clear_bits(&tasks_enabled, BIT(tskid));
if (!in_interrupt_context() && tskid == task_get_current())
__schedule(0, 0);
@@ -455,7 +454,7 @@ void mutex_lock(struct mutex *mtx)
uint32_t id = 1 << task_get_current();
ASSERT(id != TASK_ID_INVALID);
- deprecated_atomic_or(&mtx->waiters, id);
+ atomic_or(&mtx->waiters, id);
do {
old_val = 0;
@@ -471,7 +470,7 @@ void mutex_lock(struct mutex *mtx)
}
} while (old_val);
- deprecated_atomic_clear_bits(&mtx->waiters, id);
+ atomic_clear_bits(&mtx->waiters, id);
}
void mutex_unlock(struct mutex *mtx)
@@ -498,7 +497,7 @@ void mutex_unlock(struct mutex *mtx)
}
/* Ensure no event is remaining from mutex wake-up */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
}
void task_print_list(void)
diff --git a/core/nds32/task.c b/core/nds32/task.c
index 209395e86a..2fc2302c67 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 = deprecated_atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_read_clear(&tsk->events))) {
/* Remove ourself and get the next task in the scheduler */
__schedule(1, resched, 0);
resched = TASK_ID_IDLE;
@@ -411,7 +411,7 @@ static uint32_t __ram_code __wait_evt(int timeout_us, task_id_t resched)
if (timeout_us > 0) {
timer_cancel(me);
/* Ensure timer event is clear, we no longer care about it */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
}
return evt;
}
@@ -422,12 +422,12 @@ uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event, int wait)
ASSERT(receiver);
/* Set the event bit in the receiver message bitmap */
- deprecated_atomic_or(&receiver->events, event);
+ atomic_or(&receiver->events, event);
/* Re-schedule if priorities have changed */
if (in_interrupt_context()) {
/* The receiver might run again */
- deprecated_atomic_or(&tasks_ready, 1 << tskid);
+ atomic_or(&tasks_ready, 1 << tskid);
if (start_called)
need_resched = 1;
} else {
@@ -468,8 +468,7 @@ uint32_t __ram_code task_wait_event_mask(uint32_t event_mask, int timeout_us)
/* Re-post any other events collected */
if (events & ~event_mask)
- deprecated_atomic_or(&current_task->events,
- events & ~event_mask);
+ atomic_or(&current_task->events, events & ~event_mask);
return events & event_mask;
}
@@ -521,12 +520,12 @@ void task_enable_all_tasks(void)
void task_enable_task(task_id_t tskid)
{
- deprecated_atomic_or(&tasks_enabled, BIT(tskid));
+ atomic_or(&tasks_enabled, BIT(tskid));
}
void task_disable_task(task_id_t tskid)
{
- deprecated_atomic_clear_bits(&tasks_enabled, BIT(tskid));
+ atomic_clear_bits(&tasks_enabled, BIT(tskid));
if (!in_interrupt_context() && tskid == task_get_current())
__schedule(0, 0, 0);
@@ -653,7 +652,7 @@ void __ram_code mutex_unlock(struct mutex *mtx)
}
/* Ensure no event is remaining from mutex wake-up */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
}
void task_print_list(void)
diff --git a/core/riscv-rv32i/task.c b/core/riscv-rv32i/task.c
index ecd8d72382..b5f78b12d4 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 = deprecated_atomic_read_clear(&tsk->events))) {
+ while (!(evt = atomic_read_clear(&tsk->events))) {
/* Remove ourself and get the next task in the scheduler */
__schedule(1, resched, 0);
resched = TASK_ID_IDLE;
@@ -405,7 +405,7 @@ static uint32_t __ram_code __wait_evt(int timeout_us, task_id_t resched)
if (timeout_us > 0) {
timer_cancel(me);
/* Ensure timer event is clear, we no longer care about it */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_TIMER);
}
return evt;
}
@@ -417,12 +417,12 @@ uint32_t __ram_code task_set_event(task_id_t tskid, uint32_t event, int wait)
ASSERT(receiver);
/* Set the event bit in the receiver message bitmap */
- deprecated_atomic_or(&receiver->events, event);
+ atomic_or(&receiver->events, event);
/* Re-schedule if priorities have changed */
if (in_interrupt_context()) {
/* The receiver might run again */
- deprecated_atomic_or(&tasks_ready, 1 << tskid);
+ atomic_or(&tasks_ready, 1 << tskid);
if (start_called)
need_resched = 1;
} else {
@@ -463,8 +463,7 @@ uint32_t __ram_code task_wait_event_mask(uint32_t event_mask, int timeout_us)
/* Re-post any other events collected */
if (events & ~event_mask)
- deprecated_atomic_or(&current_task->events,
- events & ~event_mask);
+ atomic_or(&current_task->events, events & ~event_mask);
return events & event_mask;
}
@@ -494,12 +493,12 @@ void task_enable_all_tasks(void)
void task_enable_task(task_id_t tskid)
{
- deprecated_atomic_or(&tasks_enabled, BIT(tskid));
+ atomic_or(&tasks_enabled, BIT(tskid));
}
void task_disable_task(task_id_t tskid)
{
- deprecated_atomic_clear_bits(&tasks_enabled, BIT(tskid));
+ atomic_clear_bits(&tasks_enabled, BIT(tskid));
if (!in_interrupt_context() && tskid == task_get_current())
__schedule(0, 0, 0);
@@ -558,7 +557,7 @@ void __ram_code mutex_lock(struct mutex *mtx)
uint32_t id = 1 << task_get_current();
ASSERT(id != TASK_ID_INVALID);
- deprecated_atomic_or(&mtx->waiters, id);
+ atomic_or(&mtx->waiters, id);
while (1) {
asm volatile (
@@ -575,7 +574,7 @@ void __ram_code mutex_lock(struct mutex *mtx)
task_wait_event_mask(TASK_EVENT_MUTEX, 0);
}
- deprecated_atomic_clear_bits(&mtx->waiters, id);
+ atomic_clear_bits(&mtx->waiters, id);
}
void __ram_code mutex_unlock(struct mutex *mtx)
@@ -599,7 +598,7 @@ void __ram_code mutex_unlock(struct mutex *mtx)
}
/* Ensure no event is remaining from mutex wake-up */
- deprecated_atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
+ atomic_clear_bits(&tsk->events, TASK_EVENT_MUTEX);
}
void task_print_list(void)
diff --git a/driver/charger/sm5803.c b/driver/charger/sm5803.c
index 4b996e9e64..66d7f1144d 100644
--- a/driver/charger/sm5803.c
+++ b/driver/charger/sm5803.c
@@ -1014,7 +1014,7 @@ void sm5803_handle_interrupt(int chgnum)
static void sm5803_irq_deferred(void)
{
int i;
- uint32_t pending = deprecated_atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_read_clear(&irq_pending);
for (i = 0; i < CHARGER_NUM; i++)
if (BIT(i) & pending)
@@ -1024,7 +1024,7 @@ DECLARE_DEFERRED(sm5803_irq_deferred);
void sm5803_interrupt(int chgnum)
{
- deprecated_atomic_or(&irq_pending, BIT(chgnum));
+ atomic_or(&irq_pending, BIT(chgnum));
hook_call_deferred(&sm5803_irq_deferred_data, 0);
}
diff --git a/driver/ppc/aoz1380.c b/driver/ppc/aoz1380.c
index c4d3cc6056..4936647f37 100644
--- a/driver/ppc/aoz1380.c
+++ b/driver/ppc/aoz1380.c
@@ -32,9 +32,8 @@ static uint32_t irq_pending; /* Bitmask of ports signaling an interrupt. */
#define AOZ1380_FLAGS_INT_ON_DISCONNECT BIT(2)
static uint32_t flags[CONFIG_USB_PD_PORT_MAX_COUNT];
-#define AOZ1380_SET_FLAG(port, flag) deprecated_atomic_or(&flags[port], (flag))
-#define AOZ1380_CLR_FLAG(port, flag) \
- deprecated_atomic_clear_bits(&flags[port], (flag))
+#define AOZ1380_SET_FLAG(port, flag) atomic_or(&flags[port], (flag))
+#define AOZ1380_CLR_FLAG(port, flag) atomic_clear_bits(&flags[port], (flag))
static int aoz1380_init(int port)
{
@@ -144,7 +143,7 @@ static void aoz1380_handle_interrupt(int port)
static void aoz1380_irq_deferred(void)
{
int i;
- uint32_t pending = deprecated_atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_read_clear(&irq_pending);
for (i = 0; i < board_get_usb_pd_port_count(); i++)
if (BIT(i) & pending)
@@ -154,7 +153,7 @@ DECLARE_DEFERRED(aoz1380_irq_deferred);
void aoz1380_interrupt(int port)
{
- deprecated_atomic_or(&irq_pending, BIT(port));
+ atomic_or(&irq_pending, BIT(port));
hook_call_deferred(&aoz1380_irq_deferred_data, 0);
}
diff --git a/driver/ppc/nx20p348x.c b/driver/ppc/nx20p348x.c
index c13087fa52..8142681bb4 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 = deprecated_atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_read_clear(&irq_pending);
for (i = 0; i < board_get_usb_pd_port_count(); i++)
if (BIT(i) & pending)
@@ -394,7 +394,7 @@ DECLARE_DEFERRED(nx20p348x_irq_deferred);
void nx20p348x_interrupt(int port)
{
- deprecated_atomic_or(&irq_pending, BIT(port));
+ atomic_or(&irq_pending, BIT(port));
hook_call_deferred(&nx20p348x_irq_deferred_data, 0);
}
diff --git a/driver/ppc/sn5s330.c b/driver/ppc/sn5s330.c
index 0de09ca60d..f177efa10c 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 = deprecated_atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_read_clear(&irq_pending);
for (i = 0; i < board_get_usb_pd_port_count(); i++)
if (BIT(i) & pending)
@@ -722,7 +722,7 @@ DECLARE_DEFERRED(sn5s330_irq_deferred);
void sn5s330_interrupt(int port)
{
- deprecated_atomic_or(&irq_pending, BIT(port));
+ atomic_or(&irq_pending, BIT(port));
hook_call_deferred(&sn5s330_irq_deferred_data, 0);
}
diff --git a/driver/ppc/syv682x.c b/driver/ppc/syv682x.c
index 32508a87cf..714406a366 100644
--- a/driver/ppc/syv682x.c
+++ b/driver/ppc/syv682x.c
@@ -499,7 +499,7 @@ static void syv682x_handle_interrupt(int port)
static void syv682x_irq_deferred(void)
{
int i;
- uint32_t pending = deprecated_atomic_read_clear(&irq_pending);
+ uint32_t pending = atomic_read_clear(&irq_pending);
for (i = 0; i < board_get_usb_pd_port_count(); i++)
if (BIT(i) & pending)
@@ -509,7 +509,7 @@ DECLARE_DEFERRED(syv682x_irq_deferred);
static void syv682x_interrupt_delayed(int port, int delay)
{
- deprecated_atomic_or(&irq_pending, BIT(port));
+ atomic_or(&irq_pending, BIT(port));
hook_call_deferred(&syv682x_irq_deferred_data, delay * MSEC);
}
diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c
index fd6a5906a5..a311abd0df 100644
--- a/driver/tcpm/tcpci.c
+++ b/driver/tcpm/tcpci.c
@@ -892,7 +892,7 @@ int tcpm_enqueue_message(const int port)
}
/* Increment atomically to ensure get_message_raw happens-before */
- deprecated_atomic_add(&q->head, 1);
+ atomic_add(&q->head, 1);
/* Wake PD task up so it can process incoming RX messages */
task_set_event(PD_PORT_TO_TASK_ID(port), TASK_EVENT_WAKE, 0);
@@ -924,7 +924,7 @@ int tcpm_dequeue_message(const int port, uint32_t *const payload,
memcpy(payload, tail->payload, sizeof(tail->payload));
/* Increment atomically to ensure memcpy happens-before */
- deprecated_atomic_add(&q->tail, 1);
+ atomic_add(&q->tail, 1);
return EC_SUCCESS;
}
diff --git a/include/system.h b/include/system.h
index bbbbf4d4ce..965bf93abc 100644
--- a/include/system.h
+++ b/include/system.h
@@ -514,7 +514,7 @@ extern uint32_t sleep_mask;
*/
static inline void enable_sleep(uint32_t mask)
{
- deprecated_atomic_clear_bits(&sleep_mask, mask);
+ atomic_clear_bits(&sleep_mask, mask);
}
/**
@@ -525,7 +525,7 @@ static inline void enable_sleep(uint32_t mask)
*/
static inline void disable_sleep(uint32_t mask)
{
- deprecated_atomic_or(&sleep_mask, mask);
+ atomic_or(&sleep_mask, mask);
}
#ifdef CONFIG_LOW_POWER_IDLE_LIMITED
@@ -543,12 +543,12 @@ static inline uint32_t idle_is_disabled(void)
static inline void disable_idle(void)
{
- deprecated_atomic_or(&idle_disabled, 1);
+ atomic_or(&idle_disabled, 1);
}
static inline void enable_idle(void)
{
- deprecated_atomic_clear_bits(&idle_disabled, 1);
+ atomic_clear_bits(&idle_disabled, 1);
}
#endif
diff --git a/test/stm32f_rtc.c b/test/stm32f_rtc.c
index 7eb1930892..fc1d0aaedb 100644
--- a/test/stm32f_rtc.c
+++ b/test/stm32f_rtc.c
@@ -13,7 +13,7 @@ static const int rtc_delay_ms = 500;
/* Override default RTC interrupt handler */
void __rtc_alarm_irq(void)
{
- deprecated_atomic_add(&rtc_fired, 1);
+ atomic_add(&rtc_fired, 1);
reset_rtc_alarm(&rtc_irq);
}
@@ -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, deprecated_atomic_read_clear(&rtc_fired), "%d");
+ TEST_EQ(1, atomic_read_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 41260c1238..f3efe18fe8 100644
--- a/zephyr/shim/include/atomic.h
+++ b/zephyr/shim/include/atomic.h
@@ -8,38 +8,14 @@
#include <sys/atomic.h>
-/*
- * Below EC APIs are being deprecated and replaced with the Zephyr
- * APIs. We already get the Zephyr APIs from sys/atomic.h. The
- * definitions here are provided so we can shim-in modules using the
- * deprecated APIs while the transition is under way.
- */
-static inline void deprecated_atomic_clear_bits(uint32_t volatile *addr,
- uint32_t bits)
-{
- atomic_and((atomic_t *)addr, bits);
-}
-
-static inline void deprecated_atomic_or(uint32_t volatile *addr, uint32_t bits)
-{
- atomic_or((atomic_t *)addr, bits);
-}
-
-static inline void deprecated_atomic_add(uint32_t volatile *addr,
- uint32_t value)
-{
- atomic_add((atomic_t *)addr, value);
-}
-
-static inline void deprecated_atomic_sub(uint32_t volatile *addr,
- uint32_t value)
+static inline void atomic_clear_bits(atomic_t *addr, atomic_val_t bits)
{
- atomic_sub((atomic_t *)addr, value);
+ atomic_and(addr, ~bits);
}
-static inline uint32_t deprecated_atomic_read_clear(uint32_t volatile *addr)
+static inline atomic_val_t atomic_read_clear(atomic_t *addr)
{
- return atomic_clear((atomic_t *)addr);
+ return atomic_clear(addr);
}
#endif /* __CROS_EC_ATOMIC_H */