diff options
author | Dawid Niedzwiecki <dn@semihalf.com> | 2020-10-07 12:13:52 +0200 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-10-27 09:35:49 +0000 |
commit | a05f7b9f469e7c171f4a737968ab5cbd11ba1253 (patch) | |
tree | ab128a89ce9206ca967ad104e307d6c0b4c33a52 /core/nds32 | |
parent | 3cba51e9e807e7015d81c2891c47ea4c59587a1c (diff) | |
download | chrome-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 'core/nds32')
-rw-r--r-- | core/nds32/task.c | 17 |
1 files changed, 8 insertions, 9 deletions
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(¤t_task->events, - events & ~event_mask); + atomic_or(¤t_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) |