summaryrefslogtreecommitdiff
path: root/common/usbc/usb_tc_drp_acc_trysrc_sm.c
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/usbc/usb_tc_drp_acc_trysrc_sm.c
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/usbc/usb_tc_drp_acc_trysrc_sm.c')
-rw-r--r--common/usbc/usb_tc_drp_acc_trysrc_sm.c54
1 files changed, 31 insertions, 23 deletions
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 */