summaryrefslogtreecommitdiff
path: root/core/nds32/task.c
diff options
context:
space:
mode:
authorDawid Niedzwiecki <dn@semihalf.com>2021-11-25 14:40:48 +0100
committerCommit Bot <commit-bot@chromium.org>2021-12-07 08:50:15 +0000
commit1b1214d973aa2d092301d8a5973b47e7c261e578 (patch)
treedea9e96dd9198ee978374d45b0968fd47de78a44 /core/nds32/task.c
parentbb4c47af02a21be2cc9205adc8bae83862de780a (diff)
downloadchrome-ec-1b1214d973aa2d092301d8a5973b47e7c261e578.tar.gz
task: use atomic_t for some variables
Use the atomic_t variable type for tasks_ready, tasks_enabled and waiters in struct mutex. The generated asm code is different around the line: char is_ready = ((uint32_t)tasks_ready & BIT(i)) ? 'R' : ' '; for all cores, so cast tasks_ready to an unsigned variable to make sure is works as intended regardless of architecture. The change will be useful for incoming commits related to modifying atomic_t caused by a change in Zephyr upstream (atomic_t from int to long). BUG=b:207082842 TEST=make buildall && zmake testall BRANCH=main Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I0a55c71947401e4137b30fc62adba84d867f56f8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3301710 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Dawid Niedzwiecki <dawidn@google.com>
Diffstat (limited to 'core/nds32/task.c')
-rw-r--r--core/nds32/task.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/nds32/task.c b/core/nds32/task.c
index 376ba08ad7..0503495f17 100644
--- a/core/nds32/task.c
+++ b/core/nds32/task.c
@@ -159,13 +159,13 @@ int need_resched;
* can do their init within a task switching context. The hooks task will then
* make a call to enable all tasks.
*/
-static uint32_t tasks_ready = BIT(TASK_ID_HOOKS);
+static atomic_t tasks_ready = BIT(TASK_ID_HOOKS);
/*
* Initially allow only the HOOKS and IDLE task to run, regardless of ready
* status, in order for HOOK_INIT to complete before other tasks.
* task_enable_all_tasks() will open the flood gates.
*/
-static uint32_t tasks_enabled = BIT(TASK_ID_HOOKS) | BIT(TASK_ID_IDLE);
+static atomic_t tasks_enabled = BIT(TASK_ID_HOOKS) | BIT(TASK_ID_IDLE);
int start_called; /* Has task swapping started */
@@ -670,7 +670,7 @@ void task_print_list(void)
ccputs("Task Ready Name Events Time (s) StkUsed\n");
for (i = 0; i < TASK_ID_COUNT; i++) {
- char is_ready = (tasks_ready & (1<<i)) ? 'R' : ' ';
+ char is_ready = ((uint32_t)tasks_ready & BIT(i)) ? 'R' : ' ';
uint32_t *sp;
int stackused = tasks_init[i].stack_size;