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 /common/timer.c | |
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 'common/timer.c')
-rw-r--r-- | common/timer.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/common/timer.c b/common/timer.c index c359efb541..7b6cd0b5f5 100644 --- a/common/timer.c +++ b/common/timer.c @@ -41,7 +41,7 @@ static int timer_irq; static void expire_timer(task_id_t tskid) { /* we are done with this timer */ - deprecated_atomic_clear_bits(&timer_running, 1 << tskid); + atomic_clear_bits(&timer_running, 1 << tskid); /* wake up the taks waiting for this timer */ task_set_event(tskid, TASK_EVENT_TIMER, 0); } @@ -132,7 +132,7 @@ int timer_arm(timestamp_t event, task_id_t tskid) return EC_ERROR_BUSY; timer_deadline[tskid] = event; - deprecated_atomic_or(&timer_running, BIT(tskid)); + atomic_or(&timer_running, BIT(tskid)); /* Modify the next event if needed */ if ((event.le.hi < now.le.hi) || @@ -146,7 +146,7 @@ void timer_cancel(task_id_t tskid) { ASSERT(tskid < TASK_ID_COUNT); - deprecated_atomic_clear_bits(&timer_running, BIT(tskid)); + atomic_clear_bits(&timer_running, BIT(tskid)); /* * Don't need to cancel the hardware timer interrupt, instead do * timer-related housekeeping when the next timer interrupt fires. @@ -186,8 +186,8 @@ void usleep(unsigned us) /* Re-queue other events which happened in the meanwhile */ if (evt) - deprecated_atomic_or(task_get_event_bitmap(task_get_current()), - evt & ~TASK_EVENT_TIMER); + atomic_or(task_get_event_bitmap(task_get_current()), + evt & ~TASK_EVENT_TIMER); } timestamp_t get_time(void) |