summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorJack Rosenthal <jrosenth@chromium.org>2020-09-23 15:21:18 -0600
committerCommit Bot <commit-bot@chromium.org>2020-09-29 16:30:59 +0000
commitd4be394be0b91a71b2f16ca476114b7470bc630f (patch)
treee08dd7e428be1d27b65c4bae3ba8a47e40c8b1a5 /common
parent9513a63a626021b071199d02b7c73112eb746833 (diff)
downloadchrome-ec-d4be394be0b91a71b2f16ca476114b7470bc630f.tar.gz
tree: rename atomic_* functions to deprecated_atomic_*
We will move to an API compatible with Zephyr's API. See the bug for complete rationale and plan. BUG=b:169151160 BRANCH=none TEST=buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Id611f663446abf00b24298a669f2ae47fef7f632 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2427507 Tested-by: Dawid Niedźwiecki <dn@semihalf.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'common')
-rw-r--r--common/button.c8
-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.c18
-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.c17
-rw-r--r--common/usbc/usb_pe_drp_sm.c23
-rw-r--r--common/usbc/usb_prl_sm.c28
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c54
-rw-r--r--common/usbc_ppc.c6
18 files changed, 125 insertions, 99 deletions
diff --git a/common/button.c b/common/button.c
index 5e84256f91..1dcebae3bd 100644
--- a/common/button.c
+++ b/common/button.c
@@ -381,8 +381,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 */
- atomic_clear(&sim_button_state,
- BIT(buttons[button_idx].type));
+ deprecated_atomic_clear(&sim_button_state,
+ BIT(buttons[button_idx].type));
button_interrupt_simulate(button_idx);
}
@@ -398,8 +398,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 */
- atomic_or(&sim_button_state,
- BIT(buttons[button_idx].type));
+ deprecated_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 ab3da5a17c..de88d3e437 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)
- atomic_or(&source_port_bitmap, 1 << port);
+ deprecated_atomic_or(&source_port_bitmap, 1 << port);
else
- atomic_clear(&source_port_bitmap, 1 << port);
+ deprecated_atomic_clear(&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 ab11c0826c..16d34b8729 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 deprecated_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);
- atomic_or(&device_current_events, mask);
+ deprecated_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);
- atomic_clear(&device_current_events, mask);
+ deprecated_atomic_clear(&device_current_events, mask);
}
static void device_set_enabled_events(uint32_t mask)
diff --git a/common/dptf.c b/common/dptf.c
index acc04b123f..75bcdcad01 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? */
- atomic_clear(&dptf_seen, BIT(id));
+ deprecated_atomic_clear(&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);
- atomic_or(&dptf_seen, BIT(sensor_id));
+ deprecated_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);
- atomic_or(&dptf_seen, BIT(sensor_id));
+ deprecated_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;
- atomic_clear(&dptf_seen, BIT(sensor_id));
+ deprecated_atomic_clear(&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 2965b52fe9..5611fd828d 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)
{
- atomic_or(&fp_events, event);
+ deprecated_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 = atomic_read_clear(&fp_events);
+ event = deprecated_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 = atomic_read_clear(&fp_events);
+ uint32_t event = deprecated_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);
- atomic_read_clear(&fp_events);
+ deprecated_atomic_read_clear(&fp_events);
return rc;
}
diff --git a/common/fpsensor/fpsensor_state.c b/common/fpsensor/fpsensor_state.c
index ec4ddb4fd9..82fa4f23a1 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 = deprecated_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 e8619c6a62..01e1d577cf 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;
- atomic_or(ptr, (uint32_t)m);
+ deprecated_atomic_or(ptr, (uint32_t)m);
#ifdef CONFIG_HOST_EVENT64
- atomic_or(ptr + 1, (uint32_t)(m >> 32));
+ deprecated_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;
- atomic_clear(ptr, (uint32_t)m);
+ deprecated_atomic_clear(ptr, (uint32_t)m);
#ifdef CONFIG_HOST_EVENT64
- atomic_clear(ptr + 1, (uint32_t)(m >> 32));
+ deprecated_atomic_clear(ptr + 1, (uint32_t)(m >> 32));
#endif
}
diff --git a/common/keyboard_mkbp.c b/common/keyboard_mkbp.c
index 45cd50f4f5..9b41ef593e 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;
- atomic_sub(&fifo_entries, 1);
+ deprecated_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;
- atomic_add(&fifo_entries, 1);
+ deprecated_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 f964ad7509..7e68c28bee 100644
--- a/common/keyboard_scan.c
+++ b/common/keyboard_scan.c
@@ -143,9 +143,10 @@ void keyboard_scan_enable(int enable, enum kb_scan_disable_masks mask)
{
/* Access atomically */
if (enable) {
- atomic_clear((uint32_t *)&disable_scanning_mask, mask);
+ deprecated_atomic_clear((uint32_t *)&disable_scanning_mask,
+ mask);
} else {
- atomic_or((uint32_t *)&disable_scanning_mask, mask);
+ deprecated_atomic_or((uint32_t *)&disable_scanning_mask, mask);
clear_typematic_key();
}
diff --git a/common/motion_sense.c b/common/motion_sense.c
index c1bf6b8930..e739bc8f75 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -677,11 +677,12 @@ 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 =
+ deprecated_atomic_read_clear(&odr_event_required);
is_odr_pending = odr_pending & sensor_bit;
odr_pending &= ~sensor_bit;
- atomic_or(&odr_event_required, odr_pending);
+ deprecated_atomic_or(&odr_event_required, odr_pending);
}
#ifdef CONFIG_ACCEL_INTERRUPTS
@@ -707,7 +708,8 @@ 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 =
+ deprecated_atomic_read_clear(&sensor->flush_pending);
for (; flush_pending > 0; flush_pending--) {
motion_sense_fifo_insert_async_event(
@@ -1170,8 +1172,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.
*/
- atomic_or(&odr_event_required,
- 1 << (sensor - motion_sensors));
+ deprecated_atomic_or(&odr_event_required,
+ 1 << (sensor - motion_sensors));
task_set_event(TASK_ID_MOTIONSENSE,
TASK_EVENT_MOTION_ODR_CHANGE, 0);
}
@@ -1292,7 +1294,7 @@ static enum ec_status host_cmd_motion_sense(struct host_cmd_handler_args *args)
if (sensor == NULL)
return EC_RES_INVALID_PARAM;
- atomic_add(&sensor->flush_pending, 1);
+ deprecated_atomic_add(&sensor->flush_pending, 1);
task_set_event(TASK_ID_MOTIONSENSE,
TASK_EVENT_MOTION_FLUSH_PENDING, 0);
@@ -1645,8 +1647,8 @@ static int command_accel_data_rate(int argc, char **argv)
sensor->config[config_id].odr =
data | (round ? ROUND_UP_FLAG : 0);
- atomic_or(&odr_event_required,
- 1 << (sensor - motion_sensors));
+ deprecated_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 9a149f93e6..b4c31360b6 100644
--- a/common/timer.c
+++ b/common/timer.c
@@ -33,7 +33,7 @@ static int timer_irq;
static void expire_timer(task_id_t tskid)
{
/* we are done with this timer */
- atomic_clear(&timer_running, 1 << tskid);
+ deprecated_atomic_clear(&timer_running, 1 << tskid);
/* wake up the taks waiting for this timer */
task_set_event(tskid, TASK_EVENT_TIMER, 0);
}
@@ -124,7 +124,7 @@ int timer_arm(timestamp_t event, task_id_t tskid)
return EC_ERROR_BUSY;
timer_deadline[tskid] = event;
- atomic_or(&timer_running, BIT(tskid));
+ deprecated_atomic_or(&timer_running, BIT(tskid));
/* Modify the next event if needed */
if ((event.le.hi < now.le.hi) ||
@@ -138,7 +138,7 @@ void timer_cancel(task_id_t tskid)
{
ASSERT(tskid < TASK_ID_COUNT);
- atomic_clear(&timer_running, BIT(tskid));
+ deprecated_atomic_clear(&timer_running, BIT(tskid));
/*
* Don't need to cancel the hardware timer interrupt, instead do
* timer-related housekeeping when the next timer interrupt fires.
@@ -170,8 +170,8 @@ void usleep(unsigned us)
/* Re-queue other events which happened in the meanwhile */
if (evt)
- atomic_or(task_get_event_bitmap(task_get_current()),
- evt & ~TASK_EVENT_TIMER);
+ deprecated_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 a64999aad9..47b0bc9454 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 = deprecated_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. */
- atomic_or(&port_oc_reset_req, BIT(port));
+ deprecated_atomic_or(&port_oc_reset_req, BIT(port));
hook_call_deferred(&re_enable_ports_data, SECOND);
}
@@ -743,7 +743,8 @@ 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 =
+ deprecated_atomic_read_clear(&pd_ports_to_resume);
while (suspended_ports) {
port = __builtin_ctz(suspended_ports);
@@ -755,7 +756,7 @@ DECLARE_DEFERRED(resume_pd_port);
void pd_deferred_resume(int port)
{
- atomic_or(&pd_ports_to_resume, 1 << port);
+ deprecated_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 19e74b47aa..8bdc50a0e3 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 atomic_ functions which use assembly to access them.
+ * address to deprecated_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 = atomic_read_clear(&pd_host_event_status);
+ r->status = deprecated_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;
- atomic_or(&pd_host_event_status, mask);
+ deprecated_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 83d16720d1..cbf1a193cb 100644
--- a/common/usb_pd_protocol.c
+++ b/common/usb_pd_protocol.c
@@ -531,10 +531,11 @@ 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.
*/
- atomic_clear(task_get_event_bitmap(task_get_current()),
- PD_EVENT_TCPC_RESET);
+ deprecated_atomic_clear(task_get_event_bitmap(task_get_current()),
+ PD_EVENT_TCPC_RESET);
- waiting_tasks = atomic_read_clear(&pd[port].tasks_waiting_on_reset);
+ waiting_tasks =
+ deprecated_atomic_read_clear(&pd[port].tasks_waiting_on_reset);
/*
* Now that we are done waking up the device, handle device access
@@ -562,8 +563,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 */
- atomic_or(&pd[port].tasks_waiting_on_reset,
- 1 << task_get_current());
+ deprecated_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,
@@ -607,9 +608,11 @@ void pd_prevent_low_power_mode(int port, int prevent)
const int current_task_mask = (1 << task_get_current());
if (prevent)
- atomic_or(&pd[port].tasks_preventing_lpm, current_task_mask);
+ deprecated_atomic_or(&pd[port].tasks_preventing_lpm,
+ current_task_mask);
else
- atomic_clear(&pd[port].tasks_preventing_lpm, current_task_mask);
+ deprecated_atomic_clear(&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 bc21fb466c..45074126f3 100644
--- a/common/usbc/usb_pe_drp_sm.c
+++ b/common/usbc/usb_pe_drp_sm.c
@@ -64,17 +64,19 @@
#define CPRINTS_L3(format, args...) CPRINTS_LX(3, format, ## args)
-#define PE_SET_FLAG(port, flag) atomic_or(&pe[port].flags, (flag))
-#define PE_CLR_FLAG(port, flag) atomic_clear(&pe[port].flags, (flag))
+#define PE_SET_FLAG(port, flag) deprecated_atomic_or(&pe[port].flags, (flag))
+#define PE_CLR_FLAG(port, flag) deprecated_atomic_clear(&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) atomic_or(&pe[port].dpm_request, (req))
-#define PE_CLR_DPM_REQUEST(port, req) atomic_clear(&pe[port].dpm_request, (req))
-#define PE_CHK_DPM_REQUEST(port, req) (pe[port].dpm_request & (req))
+#define PE_SET_DPM_REQUEST(port, req) \
+ deprecated_atomic_or(&pe[port].dpm_request, (req))
+#define PE_CLR_DPM_REQUEST(port, req) \
+ deprecated_atomic_clear(&pe[port].dpm_request, (req))
+#define PE_CHK_DPM_REQUEST(port, req) (pe[port].dpm_request & (req))
/*
* Policy Engine Layer Flags
@@ -6078,9 +6080,10 @@ void pd_dfp_discovery_init(int port)
PE_CLR_FLAG(port, PE_FLAGS_VDM_SETUP_DONE |
PE_FLAGS_MODAL_OPERATION);
- 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()));
+ 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()));
memset(pe[port].discovery, 0, sizeof(pe[port].discovery));
memset(pe[port].partner_amodes, 0, sizeof(pe[port].partner_amodes));
@@ -6100,7 +6103,7 @@ void pd_dfp_discovery_init(int port)
void pd_discovery_access_clear(int port, enum tcpm_transmit_type type)
{
- atomic_clear(&task_access[port][type], 0xFFFFFFFF);
+ deprecated_atomic_clear(&task_access[port][type], 0xFFFFFFFF);
}
bool pd_discovery_access_validate(int port, enum tcpm_transmit_type type)
@@ -6112,7 +6115,7 @@ struct pd_discovery *pd_get_am_discovery(int port, enum tcpm_transmit_type type)
{
ASSERT(type < DISCOVERY_TYPE_COUNT);
- atomic_or(&task_access[port][type], BIT(task_get_current()));
+ deprecated_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 0cee9da45d..dd8a06c0bd 100644
--- a/common/usbc/usb_prl_sm.c
+++ b/common/usbc/usb_prl_sm.c
@@ -40,24 +40,32 @@
#define CPRINTS(format, args...)
#endif
-#define RCH_SET_FLAG(port, flag) atomic_or(&rch[port].flags, (flag))
-#define RCH_CLR_FLAG(port, flag) atomic_clear(&rch[port].flags, (flag))
+#define RCH_SET_FLAG(port, flag) deprecated_atomic_or(&rch[port].flags, (flag))
+#define RCH_CLR_FLAG(port, flag) \
+ deprecated_atomic_clear(&rch[port].flags, (flag))
#define RCH_CHK_FLAG(port, flag) (rch[port].flags & (flag))
-#define TCH_SET_FLAG(port, flag) atomic_or(&tch[port].flags, (flag))
-#define TCH_CLR_FLAG(port, flag) atomic_clear(&tch[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(&tch[port].flags, (flag))
#define TCH_CHK_FLAG(port, flag) (tch[port].flags & (flag))
-#define PRL_TX_SET_FLAG(port, flag) atomic_or(&prl_tx[port].flags, (flag))
-#define PRL_TX_CLR_FLAG(port, flag) atomic_clear(&prl_tx[port].flags, (flag))
+#define PRL_TX_SET_FLAG(port, flag) \
+ deprecated_atomic_or(&prl_tx[port].flags, (flag))
+#define PRL_TX_CLR_FLAG(port, flag) \
+ deprecated_atomic_clear(&prl_tx[port].flags, (flag))
#define PRL_TX_CHK_FLAG(port, flag) (prl_tx[port].flags & (flag))
-#define PRL_HR_SET_FLAG(port, flag) atomic_or(&prl_hr[port].flags, (flag))
-#define PRL_HR_CLR_FLAG(port, flag) atomic_clear(&prl_hr[port].flags, (flag))
+#define PRL_HR_SET_FLAG(port, flag) \
+ deprecated_atomic_or(&prl_hr[port].flags, (flag))
+#define PRL_HR_CLR_FLAG(port, flag) \
+ deprecated_atomic_clear(&prl_hr[port].flags, (flag))
#define PRL_HR_CHK_FLAG(port, flag) (prl_hr[port].flags & (flag))
-#define PDMSG_SET_FLAG(port, flag) atomic_or(&pdmsg[port].flags, (flag))
-#define PDMSG_CLR_FLAG(port, flag) atomic_clear(&pdmsg[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(&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 eb1c944072..2a5ac25944 100644
--- a/common/usbc/usb_tc_drp_acc_trysrc_sm.c
+++ b/common/usbc/usb_tc_drp_acc_trysrc_sm.c
@@ -59,16 +59,20 @@
#undef DEBUG_PRINT_FLAG_AND_EVENT_NAMES
#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); atomic_or(&tc[port].flags, (flag)); \
+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)); \
} while (0)
- #define TC_CLR_FLAG(port, flag) do { \
- print_flag(0, flag); atomic_clear(&tc[port].flags, (flag)); \
+#define TC_CLR_FLAG(port, flag) \
+ do { \
+ print_flag(0, flag); \
+ deprecated_atomic_clear(&tc[port].flags, (flag)); \
} while (0)
#else
- #define TC_SET_FLAG(port, flag) atomic_or(&tc[port].flags, (flag))
- #define TC_CLR_FLAG(port, flag) atomic_clear(&tc[port].flags, (flag))
+#define TC_SET_FLAG(port, flag) deprecated_atomic_or(&tc[port].flags, (flag))
+#define TC_CLR_FLAG(port, flag) deprecated_atomic_clear(&tc[port].flags, (flag))
#endif
#define TC_CHK_FLAG(port, flag) (tc[port].flags & (flag))
@@ -603,9 +607,11 @@ static bool pd_comm_allowed_by_policy(void)
static void tc_policy_pd_enable(int port, int en)
{
if (en)
- atomic_clear(&tc[port].pd_disabled_mask, PD_DISABLED_BY_POLICY);
+ deprecated_atomic_clear(&tc[port].pd_disabled_mask,
+ PD_DISABLED_BY_POLICY);
else
- atomic_or(&tc[port].pd_disabled_mask, PD_DISABLED_BY_POLICY);
+ deprecated_atomic_or(&tc[port].pd_disabled_mask,
+ PD_DISABLED_BY_POLICY);
CPRINTS("C%d: PD comm policy %sabled", port, en ? "en" : "dis");
}
@@ -613,20 +619,19 @@ static void tc_policy_pd_enable(int port, int en)
static void tc_enable_pd(int port, int en)
{
if (en)
- atomic_clear(&tc[port].pd_disabled_mask,
- PD_DISABLED_NO_CONNECTION);
+ deprecated_atomic_clear(&tc[port].pd_disabled_mask,
+ PD_DISABLED_NO_CONNECTION);
else
- atomic_or(&tc[port].pd_disabled_mask,
- PD_DISABLED_NO_CONNECTION);
-
+ deprecated_atomic_or(&tc[port].pd_disabled_mask,
+ PD_DISABLED_NO_CONNECTION);
}
static void tc_enable_try_src(int en)
{
if (en)
- atomic_or(&pd_try_src, 1);
+ deprecated_atomic_or(&pd_try_src, 1);
else
- atomic_clear(&pd_try_src, 1);
+ deprecated_atomic_clear(&pd_try_src, 1);
}
static void tc_detached(int port)
@@ -1743,10 +1748,11 @@ 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.
*/
- atomic_clear(task_get_event_bitmap(task_get_current()),
- PD_EVENT_TCPC_RESET);
+ deprecated_atomic_clear(task_get_event_bitmap(task_get_current()),
+ PD_EVENT_TCPC_RESET);
- waiting_tasks = atomic_read_clear(&tc[port].tasks_waiting_on_reset);
+ waiting_tasks =
+ deprecated_atomic_read_clear(&tc[port].tasks_waiting_on_reset);
/* Wake up all waiting tasks. */
while (waiting_tasks) {
@@ -1769,8 +1775,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 */
- atomic_or(&tc[port].tasks_waiting_on_reset,
- 1 << task_get_current());
+ deprecated_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,
@@ -1810,9 +1816,11 @@ void pd_prevent_low_power_mode(int port, int prevent)
return;
if (prevent)
- atomic_or(&tc[port].tasks_preventing_lpm, current_task_mask);
+ deprecated_atomic_or(&tc[port].tasks_preventing_lpm,
+ current_task_mask);
else
- atomic_clear(&tc[port].tasks_preventing_lpm, current_task_mask);
+ deprecated_atomic_clear(&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 3430a41879..7b01ed4591 100644
--- a/common/usbc_ppc.c
+++ b/common/usbc_ppc.c
@@ -82,7 +82,7 @@ int ppc_add_oc_event(int port)
oc_event_cnt_tbl[port]++;
/* The port overcurrented, so don't clear it's OC events. */
- atomic_clear(&connected_ports, 1 << port);
+ deprecated_atomic_clear(&connected_ports, 1 << port);
if (oc_event_cnt_tbl[port] >= PPC_OC_CNT_THRESH)
ppc_prints("OC event limit reached! "
@@ -264,9 +264,9 @@ void ppc_sink_is_connected(int port, int is_connected)
}
if (is_connected)
- atomic_or(&connected_ports, 1 << port);
+ deprecated_atomic_or(&connected_ports, 1 << port);
else
- atomic_clear(&connected_ports, 1 << port);
+ deprecated_atomic_clear(&connected_ports, 1 << port);
}
int ppc_vbus_sink_enable(int port, int enable)