Skip to content

Commit

Permalink
drivers: regulator: shell: print all 6-digits of micro values
Browse files Browse the repository at this point in the history
Previously only the upper/first 3 digits of a micro value
would be printed, dropping the last 3 digits. This could cause
misleading output for cmds like vlist.

(cherry picked from commit 6c244cf)

Original-Signed-off-by: Mike J. Chen <mjchen@google.com>
GitOrigin-RevId: 6c244cf
Change-Id: I7b48a5f500e8a23f3b69f25b81b188dbf88a3dfb
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5529560
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Tested-by: Ting Shen <phoenixshen@chromium.org>
Commit-Queue: Ting Shen <phoenixshen@chromium.org>
  • Loading branch information
mjchen0 authored and Chromeos LUCI committed May 9, 2024
1 parent 7d567c8 commit 9072537
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drivers/regulator/regulator_shell.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ static int strtomicro(char *inp, char units, int32_t *val)
static void microtoshell(const struct shell *sh, char unit, int32_t val)
{
if (val > 100000) {
shell_print(sh, "%d.%03d %c", val / 1000000,
(val % 1000000) / 1000, unit);
shell_print(sh, "%d.%06d %c", val / 1000000, val % 1000000, unit);
} else if (val > 1000) {
shell_print(sh, "%d.%03d m%c", val / 1000, val % 1000, unit);
} else {
Expand Down

0 comments on commit 9072537

Please sign in to comment.