From 90725378caa62d443af08d2332214250de2c46b9 Mon Sep 17 00:00:00 2001 From: "Mike J. Chen" Date: Fri, 26 Apr 2024 14:40:17 -0700 Subject: [PATCH] drivers: regulator: shell: print all 6-digits of micro values 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 6c244cf440bef54ef157b4bf65a328c9e34df843) Original-Signed-off-by: Mike J. Chen GitOrigin-RevId: 6c244cf440bef54ef157b4bf65a328c9e34df843 Change-Id: I7b48a5f500e8a23f3b69f25b81b188dbf88a3dfb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5529560 Reviewed-by: Ting Shen Tested-by: ChromeOS Prod (Robot) Tested-by: Ting Shen Commit-Queue: Ting Shen --- drivers/regulator/regulator_shell.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/regulator/regulator_shell.c b/drivers/regulator/regulator_shell.c index f9d61431cc9..508a029790f 100644 --- a/drivers/regulator/regulator_shell.c +++ b/drivers/regulator/regulator_shell.c @@ -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 {