summaryrefslogtreecommitdiff
path: root/common/usb_pd_protocol.c
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 /common/usb_pd_protocol.c
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>
Diffstat (limited to 'common/usb_pd_protocol.c')
-rw-r--r--common/usb_pd_protocol.c18
1 files changed, 8 insertions, 10 deletions
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. */