summaryrefslogtreecommitdiff
path: root/common/usb_common.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_common.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_common.c')
-rw-r--r--common/usb_common.c9
1 files changed, 4 insertions, 5 deletions
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 */