Skip to content

Commit

Permalink
kernel: Simplify k_thread_cpu_pin()
Browse files Browse the repository at this point in the history
Simplifies the k_thread_cpu_pin() implementation to leverage the
existing cpu_mask_mod() infrastructure.

Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
  • Loading branch information
peter-mitsis committed Sep 17, 2024
1 parent 48a077f commit ad84d21
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions kernel/cpu_mask.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ int k_thread_cpu_mask_disable(k_tid_t thread, int cpu)

int k_thread_cpu_pin(k_tid_t thread, int cpu)
{
int ret;
uint32_t mask = BIT(cpu);

Check notice on line 70 in kernel/cpu_mask.c

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

kernel/cpu_mask.c:70 - uint32_t mask = BIT(cpu); + uint32_t mask = BIT(cpu);
ret = k_thread_cpu_mask_clear(thread);
if (ret == 0) {
return k_thread_cpu_mask_enable(thread, cpu);
}
return ret;
return cpu_mask_mod(thread, mask, ~mask);
}

0 comments on commit ad84d21

Please sign in to comment.