shell: modules: kernel: streamline code

This commit includes cleanups to `kernel_service`:
- `shell_tdata_dump()`:
  Adjust formatting to align with `.clang-format`.
- `shell_stack_dump()`:
  Update to pass `sh` directly instead of `user_data` since
  it is already assigned.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
This commit is contained in:
Pisit Sawangvonganan 2024-10-08 08:12:50 +07:00 committed by Benjamin Cabé
commit b44250ae46
2 changed files with 10 additions and 10 deletions

View file

@ -73,14 +73,14 @@ static void shell_tdata_dump(const struct k_thread *cthread, void *user_data)
tname = k_thread_name_get(thread);
shell_print(sh, "%s%p %-10s",
(thread == k_current_get()) ? "*" : " ",
thread,
tname ? tname : "NA");
(thread == k_current_get()) ? "*" : " ",
thread,
tname ? tname : "NA");
/* Cannot use lld as it's less portable. */
shell_print(sh, "\toptions: 0x%x, priority: %d timeout: %" PRId64,
thread->base.user_options,
thread->base.prio,
(int64_t)thread->base.timeout.dticks);
thread->base.user_options,
thread->base.prio,
(int64_t)thread->base.timeout.dticks);
shell_print(sh, "\tstate: %s, entry: %p",
k_thread_state_str(thread, state_str, sizeof(state_str)),
thread->entry.pEntry);

View file

@ -41,10 +41,10 @@ static void shell_stack_dump(const struct k_thread *thread, void *user_data)
/* Calculate the real size reserved for the stack */
pcnt = ((size - unused) * 100U) / size;
shell_print(
(const struct shell *)user_data, "%p %-" STRINGIFY(THREAD_MAX_NAM_LEN) "s "
"(real size %4zu):\tunused %4zu\tusage %4zu / %4zu (%2u %%)",
thread, tname ? tname : "NA", size, unused, size - unused, size, pcnt);
shell_print(sh,
"%p %-" STRINGIFY(THREAD_MAX_NAM_LEN) "s "
"(real size %4zu):\tunused %4zu\tusage %4zu / %4zu (%2u %%)",
thread, tname ? tname : "NA", size, unused, size - unused, size, pcnt);
}
K_KERNEL_STACK_ARRAY_DECLARE(z_interrupt_stacks, CONFIG_MP_MAX_NUM_CPUS,