Skip to content

Commit

Permalink
shell: modules: kernel: streamline code
Browse files Browse the repository at this point in the history
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.

(cherry picked from commit b44250a)

Original-Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
GitOrigin-RevId: b44250a
Cr-Build-Id: 8728672958632284305
Cr-Build-Url: https://cr-buildbucket.appspot.com/build/8728672958632284305
Copybot-Job-Name: zephyr-main-copybot-downstream
Change-Id: I640131520cf18d275d1bb4af53380444cee2071d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/6093821
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
Tested-by: Jeremy Bettis <jbettis@chromium.org>
Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
  • Loading branch information
Pisit Sawangvonganan authored and Chromeos LUCI committed Dec 13, 2024
1 parent 3cfaa0e commit 638a566
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions subsys/shell/modules/kernel_service/thread/list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions subsys/shell/modules/kernel_service/thread/stacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 638a566

Please sign in to comment.