Skip to content

Commit eda5814

Browse files
peter-mitsishenrikbrixandersen
authored andcommitted
kernel: Simplify k_thread_cpu_pin()
Simplifies the k_thread_cpu_pin() implementation to leverage the existing cpu_mask_mod() infrastructure. Signed-off-by: Peter Mitsis <[email protected]>
1 parent dda9ba6 commit eda5814

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

kernel/cpu_mask.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,7 @@ int k_thread_cpu_mask_disable(k_tid_t thread, int cpu)
6666

6767
int k_thread_cpu_pin(k_tid_t thread, int cpu)
6868
{
69-
int ret;
69+
uint32_t mask = BIT(cpu);
7070

71-
ret = k_thread_cpu_mask_clear(thread);
72-
if (ret == 0) {
73-
return k_thread_cpu_mask_enable(thread, cpu);
74-
}
75-
return ret;
71+
return cpu_mask_mod(thread, mask, ~mask);
7672
}

0 commit comments

Comments
 (0)