[U-Boot] [PATCH 12/41] Move strtomhz() to vsprintf.h

Simon Glass sjg at chromium.org
Mon Sep 30 14:40:43 UTC 2019


At present this function sits in its own file but it does not really
justify it. There are similar string functions in vsprintf.h, so move it
there. Also add the missing function comment.

Use the vsprintf.h include file explicitly where needed.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/arc/lib/cpu.c                            |  1 +
 arch/arm/cpu/arm926ejs/mx25/generic.c         |  1 +
 arch/arm/cpu/arm926ejs/mx27/generic.c         |  1 +
 arch/arm/cpu/armv7/ls102xa/cpu.c              |  1 +
 arch/arm/cpu/armv8/fsl-layerscape/cpu.c       |  1 +
 arch/arm/mach-at91/arm926ejs/cpu.c            |  1 +
 arch/arm/mach-at91/armv7/cpu.c                |  1 +
 arch/m68k/cpu/mcf5227x/cpu.c                  |  1 +
 arch/m68k/cpu/mcf523x/cpu.c                   |  1 +
 arch/m68k/cpu/mcf52x2/cpu.c                   |  1 +
 arch/m68k/cpu/mcf530x/cpu.c                   |  1 +
 arch/m68k/cpu/mcf532x/cpu.c                   |  1 +
 arch/m68k/cpu/mcf5445x/cpu.c                  |  1 +
 arch/m68k/cpu/mcf547x_8x/cpu.c                |  1 +
 arch/powerpc/cpu/mpc83xx/cpu.c                |  1 +
 arch/powerpc/cpu/mpc83xx/spd_sdram.c          |  1 +
 arch/powerpc/cpu/mpc83xx/speed.c              |  1 +
 arch/powerpc/cpu/mpc85xx/cpu.c                |  1 +
 arch/powerpc/cpu/mpc86xx/cpu.c                |  1 +
 arch/powerpc/cpu/mpc8xx/cpu.c                 |  1 +
 arch/xtensa/cpu/cpu.c                         |  1 +
 board/Arcturus/ucp1020/ddr.c                  |  1 +
 board/atmel/at91sam9261ek/at91sam9261ek.c     |  1 +
 board/atmel/at91sam9263ek/at91sam9263ek.c     |  1 +
 .../atmel/at91sam9m10g45ek/at91sam9m10g45ek.c |  1 +
 board/atmel/at91sam9n12ek/at91sam9n12ek.c     |  1 +
 board/atmel/at91sam9rlek/at91sam9rlek.c       |  1 +
 board/atmel/common/video_display.c            |  1 +
 board/esd/meesc/meesc.c                       |  1 +
 board/freescale/bsc9131rdb/ddr.c              |  1 +
 board/freescale/bsc9132qds/ddr.c              |  1 +
 board/freescale/corenet_ds/ddr.c              |  1 +
 board/freescale/ls1043ardb/ddr.c              |  1 +
 board/freescale/mpc8541cds/mpc8541cds.c       |  1 +
 board/freescale/mpc8548cds/mpc8548cds.c       |  1 +
 board/freescale/mpc8555cds/mpc8555cds.c       |  1 +
 board/freescale/p1010rdb/ddr.c                |  1 +
 board/freescale/p1_p2_rdb_pc/ddr.c            |  1 +
 board/freescale/p1_twr/ddr.c                  |  1 +
 board/mini-box/picosam9g45/picosam9g45.c      |  1 +
 board/ronetix/pm9261/pm9261.c                 |  1 +
 cmd/bdinfo.c                                  |  1 +
 drivers/clk/clk_stm32mp1.c                    |  1 +
 drivers/clk/mpc83xx_clk.c                     |  1 +
 drivers/cpu/mpc83xx_cpu.c                     |  1 +
 include/common.h                              |  3 ---
 include/vsprintf.h                            | 10 +++++++++
 lib/Makefile                                  |  4 ++--
 lib/strmhz.c                                  | 21 -------------------
 lib/vsprintf.c                                | 17 +++++++++++++++
 50 files changed, 74 insertions(+), 26 deletions(-)
 delete mode 100644 lib/strmhz.c

diff --git a/arch/arc/lib/cpu.c b/arch/arc/lib/cpu.c
index 01cca95d5b1..83246550ec1 100644
--- a/arch/arc/lib/cpu.c
+++ b/arch/arc/lib/cpu.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <malloc.h>
+#include <vsprintf.h>
 #include <asm/arcregs.h>
 #include <asm/cache.h>
 
diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
index 5fcf06ae1a8..eeb61d0d102 100644
--- a/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <div64.h>
 #include <netdev.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch-imx/cpu.h>
 #include <asm/arch/imx-regs.h>
diff --git a/arch/arm/cpu/arm926ejs/mx27/generic.c b/arch/arm/cpu/arm926ejs/mx27/generic.c
index 08b1b4de717..9bed0e91bea 100644
--- a/arch/arm/cpu/arm926ejs/mx27/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx27/generic.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <div64.h>
 #include <netdev.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/imx-regs.h>
 #include <asm/arch/clock.h>
diff --git a/arch/arm/cpu/armv7/ls102xa/cpu.c b/arch/arm/cpu/armv7/ls102xa/cpu.c
index 9ccfe1042ce..ec9984db795 100644
--- a/arch/arm/cpu/armv7/ls102xa/cpu.c
+++ b/arch/arm/cpu/armv7/ls102xa/cpu.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/arch/clock.h>
 #include <asm/io.h>
 #include <asm/arch/immap_ls102xa.h>
diff --git a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
index a5d0b5370f8..fbbabc23a77 100644
--- a/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
+++ b/arch/arm/cpu/armv8/fsl-layerscape/cpu.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <env.h>
 #include <fsl_ddr_sdram.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <linux/errno.h>
 #include <asm/system.h>
diff --git a/arch/arm/mach-at91/arm926ejs/cpu.c b/arch/arm/mach-at91/arm926ejs/cpu.c
index 6f5aa4274b5..e9b4e06595e 100644
--- a/arch/arm/mach-at91/arm926ejs/cpu.c
+++ b/arch/arm/mach-at91/arm926ejs/cpu.c
@@ -7,6 +7,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pit.h>
diff --git a/arch/arm/mach-at91/armv7/cpu.c b/arch/arm/mach-at91/armv7/cpu.c
index 5da067cda10..638645c7e40 100644
--- a/arch/arm/mach-at91/armv7/cpu.c
+++ b/arch/arm/mach-at91/armv7/cpu.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/hardware.h>
 #include <asm/arch/at91_pit.h>
diff --git a/arch/m68k/cpu/mcf5227x/cpu.c b/arch/m68k/cpu/mcf5227x/cpu.c
index 7ad023dac5a..34534d876bc 100644
--- a/arch/m68k/cpu/mcf5227x/cpu.c
+++ b/arch/m68k/cpu/mcf5227x/cpu.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 
diff --git a/arch/m68k/cpu/mcf523x/cpu.c b/arch/m68k/cpu/mcf523x/cpu.c
index 79be04f7a0c..429781945bf 100644
--- a/arch/m68k/cpu/mcf523x/cpu.c
+++ b/arch/m68k/cpu/mcf523x/cpu.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <netdev.h>
diff --git a/arch/m68k/cpu/mcf52x2/cpu.c b/arch/m68k/cpu/mcf52x2/cpu.c
index 29a17c57fce..b48a753f9b7 100644
--- a/arch/m68k/cpu/mcf52x2/cpu.c
+++ b/arch/m68k/cpu/mcf52x2/cpu.c
@@ -14,6 +14,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <asm/immap.h>
diff --git a/arch/m68k/cpu/mcf530x/cpu.c b/arch/m68k/cpu/mcf530x/cpu.c
index c7ae65afce9..a76deebc68a 100644
--- a/arch/m68k/cpu/mcf530x/cpu.c
+++ b/arch/m68k/cpu/mcf530x/cpu.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/immap.h>
 #include <asm/io.h>
 
diff --git a/arch/m68k/cpu/mcf532x/cpu.c b/arch/m68k/cpu/mcf532x/cpu.c
index a01b5e65a74..c8a1f205305 100644
--- a/arch/m68k/cpu/mcf532x/cpu.c
+++ b/arch/m68k/cpu/mcf532x/cpu.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <netdev.h>
diff --git a/arch/m68k/cpu/mcf5445x/cpu.c b/arch/m68k/cpu/mcf5445x/cpu.c
index 56e5585e09e..2f79380c8be 100644
--- a/arch/m68k/cpu/mcf5445x/cpu.c
+++ b/arch/m68k/cpu/mcf5445x/cpu.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <netdev.h>
diff --git a/arch/m68k/cpu/mcf547x_8x/cpu.c b/arch/m68k/cpu/mcf547x_8x/cpu.c
index 819b25f280b..dc5ed1aa79f 100644
--- a/arch/m68k/cpu/mcf547x_8x/cpu.c
+++ b/arch/m68k/cpu/mcf547x_8x/cpu.c
@@ -9,6 +9,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <netdev.h>
diff --git a/arch/powerpc/cpu/mpc83xx/cpu.c b/arch/powerpc/cpu/mpc83xx/cpu.c
index 3048ecf34ad..363c0ffd285 100644
--- a/arch/powerpc/cpu/mpc83xx/cpu.c
+++ b/arch/powerpc/cpu/mpc83xx/cpu.c
@@ -10,6 +10,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <mpc83xx.h>
diff --git a/arch/powerpc/cpu/mpc83xx/spd_sdram.c b/arch/powerpc/cpu/mpc83xx/spd_sdram.c
index 8b5ecdb9ad1..08918a9d75e 100644
--- a/arch/powerpc/cpu/mpc83xx/spd_sdram.c
+++ b/arch/powerpc/cpu/mpc83xx/spd_sdram.c
@@ -13,6 +13,7 @@
 #ifndef CONFIG_MPC83XX_SDRAM
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/processor.h>
 #include <asm/io.h>
 #include <i2c.h>
diff --git a/arch/powerpc/cpu/mpc83xx/speed.c b/arch/powerpc/cpu/mpc83xx/speed.c
index e118a10fa8b..93af7f495fd 100644
--- a/arch/powerpc/cpu/mpc83xx/speed.c
+++ b/arch/powerpc/cpu/mpc83xx/speed.c
@@ -11,6 +11,7 @@
 #include <common.h>
 #include <mpc83xx.h>
 #include <command.h>
+#include <vsprintf.h>
 #include <asm/processor.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/arch/powerpc/cpu/mpc85xx/cpu.c b/arch/powerpc/cpu/mpc85xx/cpu.c
index bba71813bcb..8f58924b7ba 100644
--- a/arch/powerpc/cpu/mpc85xx/cpu.c
+++ b/arch/powerpc/cpu/mpc85xx/cpu.c
@@ -11,6 +11,7 @@
 #include <config.h>
 #include <common.h>
 #include <cpu_legacy.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <fsl_esdhc.h>
diff --git a/arch/powerpc/cpu/mpc86xx/cpu.c b/arch/powerpc/cpu/mpc86xx/cpu.c
index c023d0684f8..1c3c78217cb 100644
--- a/arch/powerpc/cpu/mpc86xx/cpu.c
+++ b/arch/powerpc/cpu/mpc86xx/cpu.c
@@ -6,6 +6,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <asm/cache.h>
diff --git a/arch/powerpc/cpu/mpc8xx/cpu.c b/arch/powerpc/cpu/mpc8xx/cpu.c
index 798eabdc21c..6ad86e9a1d7 100644
--- a/arch/powerpc/cpu/mpc8xx/cpu.c
+++ b/arch/powerpc/cpu/mpc8xx/cpu.c
@@ -17,6 +17,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <watchdog.h>
 #include <command.h>
 #include <mpc8xx.h>
diff --git a/arch/xtensa/cpu/cpu.c b/arch/xtensa/cpu/cpu.c
index 64bb0b6ee0b..6f4b88f88e1 100644
--- a/arch/xtensa/cpu/cpu.c
+++ b/arch/xtensa/cpu/cpu.c
@@ -10,6 +10,7 @@
 
 #include <common.h>
 #include <command.h>
+#include <vsprintf.h>
 #include <linux/stringify.h>
 #include <asm/global_data.h>
 #include <asm/cache.h>
diff --git a/board/Arcturus/ucp1020/ddr.c b/board/Arcturus/ucp1020/ddr.c
index 4b84a1a4c01..a3285ebe5cd 100644
--- a/board/Arcturus/ucp1020/ddr.c
+++ b/board/Arcturus/ucp1020/ddr.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
diff --git a/board/atmel/at91sam9261ek/at91sam9261ek.c b/board/atmel/at91sam9261ek/at91sam9261ek.c
index 6f15bc67767..28765315f74 100644
--- a/board/atmel/at91sam9261ek/at91sam9261ek.c
+++ b/board/atmel/at91sam9261ek/at91sam9261ek.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <debug_uart.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/at91sam9261.h>
 #include <asm/arch/at91sam9261_matrix.h>
diff --git a/board/atmel/at91sam9263ek/at91sam9263ek.c b/board/atmel/at91sam9263ek/at91sam9263ek.c
index 2d882174de0..31bb72c0cdc 100644
--- a/board/atmel/at91sam9263ek/at91sam9263ek.c
+++ b/board/atmel/at91sam9263ek/at91sam9263ek.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <debug_uart.h>
+#include <vsprintf.h>
 #include <linux/sizes.h>
 #include <asm/arch/at91sam9263.h>
 #include <asm/arch/at91sam9_smc.h>
diff --git a/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c b/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
index 3b277fc575e..85004310b1f 100644
--- a/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
+++ b/board/atmel/at91sam9m10g45ek/at91sam9m10g45ek.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <debug_uart.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/at91sam9g45_matrix.h>
diff --git a/board/atmel/at91sam9n12ek/at91sam9n12ek.c b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
index b2bb7ec9928..51b24e1d592 100644
--- a/board/atmel/at91sam9n12ek/at91sam9n12ek.c
+++ b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
@@ -5,6 +5,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/at91sam9x5_matrix.h>
 #include <asm/arch/at91sam9_smc.h>
diff --git a/board/atmel/at91sam9rlek/at91sam9rlek.c b/board/atmel/at91sam9rlek/at91sam9rlek.c
index 03933073157..4e674d49b31 100644
--- a/board/atmel/at91sam9rlek/at91sam9rlek.c
+++ b/board/atmel/at91sam9rlek/at91sam9rlek.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <debug_uart.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/mach-types.h>
 #include <asm/arch/at91sam9rl.h>
diff --git a/board/atmel/common/video_display.c b/board/atmel/common/video_display.c
index c7d3f8addca..105712adc1b 100644
--- a/board/atmel/common/video_display.c
+++ b/board/atmel/common/video_display.c
@@ -11,6 +11,7 @@
 #include <version.h>
 #include <video.h>
 #include <video_console.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/clk.h>
 
diff --git a/board/esd/meesc/meesc.c b/board/esd/meesc/meesc.c
index b0d2f7b6f87..221048a91f1 100644
--- a/board/esd/meesc/meesc.c
+++ b/board/esd/meesc/meesc.c
@@ -11,6 +11,7 @@
 
 #include <common.h>
 #include <env.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
 #include <asm/mach-types.h>
diff --git a/board/freescale/bsc9131rdb/ddr.c b/board/freescale/bsc9131rdb/ddr.c
index f9f8d802135..4b6d91df219 100644
--- a/board/freescale/bsc9131rdb/ddr.c
+++ b/board/freescale/bsc9131rdb/ddr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
diff --git a/board/freescale/bsc9132qds/ddr.c b/board/freescale/bsc9132qds/ddr.c
index 191ef01d23e..f4effe5a2d6 100644
--- a/board/freescale/bsc9132qds/ddr.c
+++ b/board/freescale/bsc9132qds/ddr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
diff --git a/board/freescale/corenet_ds/ddr.c b/board/freescale/corenet_ds/ddr.c
index 38f13ce4b2e..9c8731ce780 100644
--- a/board/freescale/corenet_ds/ddr.c
+++ b/board/freescale/corenet_ds/ddr.c
@@ -6,6 +6,7 @@
 #include <common.h>
 #include <i2c.h>
 #include <hwconfig.h>
+#include <vsprintf.h>
 #include <asm/mmu.h>
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
diff --git a/board/freescale/ls1043ardb/ddr.c b/board/freescale/ls1043ardb/ddr.c
index 784e482f32f..2677b7928f5 100644
--- a/board/freescale/ls1043ardb/ddr.c
+++ b/board/freescale/ls1043ardb/ddr.c
@@ -7,6 +7,7 @@
 #include <fsl_ddr_sdram.h>
 #include <fsl_ddr_dimm_params.h>
 #include "ddr.h"
+#include <vsprintf.h>
 #ifdef CONFIG_FSL_DEEP_SLEEP
 #include <fsl_sleep.h>
 #endif
diff --git a/board/freescale/mpc8541cds/mpc8541cds.c b/board/freescale/mpc8541cds/mpc8541cds.c
index 779c99c2686..be79a7ca7b8 100644
--- a/board/freescale/mpc8541cds/mpc8541cds.c
+++ b/board/freescale/mpc8541cds/mpc8541cds.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <pci.h>
+#include <vsprintf.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
diff --git a/board/freescale/mpc8548cds/mpc8548cds.c b/board/freescale/mpc8548cds/mpc8548cds.c
index 2799b5b5a4b..28f8a998ce7 100644
--- a/board/freescale/mpc8548cds/mpc8548cds.c
+++ b/board/freescale/mpc8548cds/mpc8548cds.c
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <pci.h>
+#include <vsprintf.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
diff --git a/board/freescale/mpc8555cds/mpc8555cds.c b/board/freescale/mpc8555cds/mpc8555cds.c
index 6cfb8d5191a..bc1ebc51edb 100644
--- a/board/freescale/mpc8555cds/mpc8555cds.c
+++ b/board/freescale/mpc8555cds/mpc8555cds.c
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <pci.h>
+#include <vsprintf.h>
 #include <asm/processor.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
diff --git a/board/freescale/p1010rdb/ddr.c b/board/freescale/p1010rdb/ddr.c
index 01e3eafd12a..71f6259b60e 100644
--- a/board/freescale/p1010rdb/ddr.c
+++ b/board/freescale/p1010rdb/ddr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
diff --git a/board/freescale/p1_p2_rdb_pc/ddr.c b/board/freescale/p1_p2_rdb_pc/ddr.c
index b9bd7b52765..2346f6a0c27 100644
--- a/board/freescale/p1_p2_rdb_pc/ddr.c
+++ b/board/freescale/p1_p2_rdb_pc/ddr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
diff --git a/board/freescale/p1_twr/ddr.c b/board/freescale/p1_twr/ddr.c
index 7e8bd6b8c21..85f1f6344ad 100644
--- a/board/freescale/p1_twr/ddr.c
+++ b/board/freescale/p1_twr/ddr.c
@@ -4,6 +4,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/mmu.h>
 #include <asm/immap_85xx.h>
 #include <asm/processor.h>
diff --git a/board/mini-box/picosam9g45/picosam9g45.c b/board/mini-box/picosam9g45/picosam9g45.c
index 9554fefd4ec..9a724040b07 100644
--- a/board/mini-box/picosam9g45/picosam9g45.c
+++ b/board/mini-box/picosam9g45/picosam9g45.c
@@ -11,6 +11,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <asm/io.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/at91sam9g45_matrix.h>
diff --git a/board/ronetix/pm9261/pm9261.c b/board/ronetix/pm9261/pm9261.c
index f1e7aab6296..bad673412a1 100644
--- a/board/ronetix/pm9261/pm9261.c
+++ b/board/ronetix/pm9261/pm9261.c
@@ -8,6 +8,7 @@
  */
 
 #include <common.h>
+#include <vsprintf.h>
 #include <linux/sizes.h>
 #include <asm/io.h>
 #include <asm/gpio.h>
diff --git a/cmd/bdinfo.c b/cmd/bdinfo.c
index ae6006f85ff..abd9151432e 100644
--- a/cmd/bdinfo.c
+++ b/cmd/bdinfo.c
@@ -10,6 +10,7 @@
 #include <common.h>
 #include <command.h>
 #include <env.h>
+#include <vsprintf.h>
 #include <linux/compiler.h>
 
 DECLARE_GLOBAL_DATA_PTR;
diff --git a/drivers/clk/clk_stm32mp1.c b/drivers/clk/clk_stm32mp1.c
index e87307fa60c..e223f84eac0 100644
--- a/drivers/clk/clk_stm32mp1.c
+++ b/drivers/clk/clk_stm32mp1.c
@@ -10,6 +10,7 @@
 #include <regmap.h>
 #include <spl.h>
 #include <syscon.h>
+#include <vsprintf.h>
 #include <linux/io.h>
 #include <linux/iopoll.h>
 #include <dt-bindings/clock/stm32mp1-clks.h>
diff --git a/drivers/clk/mpc83xx_clk.c b/drivers/clk/mpc83xx_clk.c
index 32d2db9edad..cbccda55943 100644
--- a/drivers/clk/mpc83xx_clk.c
+++ b/drivers/clk/mpc83xx_clk.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk-uclass.h>
 #include <dm.h>
+#include <vsprintf.h>
 #include <dm/lists.h>
 #include <dt-bindings/clk/mpc83xx-clk.h>
 #include <asm/arch/soc.h>
diff --git a/drivers/cpu/mpc83xx_cpu.c b/drivers/cpu/mpc83xx_cpu.c
index 7bc86bf9b20..1e584577421 100644
--- a/drivers/cpu/mpc83xx_cpu.c
+++ b/drivers/cpu/mpc83xx_cpu.c
@@ -9,6 +9,7 @@
 #include <clk.h>
 #include <cpu.h>
 #include <dm.h>
+#include <vsprintf.h>
 
 #include "mpc83xx_cpu.h"
 
diff --git a/include/common.h b/include/common.h
index d17a2b2642c..f993e4bef33 100644
--- a/include/common.h
+++ b/include/common.h
@@ -310,9 +310,6 @@ int ulz4fn(const void *src, size_t srcn, void *dst, size_t *dstn);
 /* lib/vsprintf.c */
 #include <vsprintf.h>
 
-/* lib/strmhz.c */
-char *	strmhz(char *buf, unsigned long hz);
-
 /*
  * STDIO based functions (can always be used)
  */
diff --git a/include/vsprintf.h b/include/vsprintf.h
index d1740a378e0..56844dd2de8 100644
--- a/include/vsprintf.h
+++ b/include/vsprintf.h
@@ -212,4 +212,14 @@ void print_grouped_ull(unsigned long long int_val, int digits);
 
 bool str2off(const char *p, loff_t *num);
 bool str2long(const char *p, ulong *num);
+
+/**
+ * strmhz() - Convert a value to a Hz string
+ *
+ * This creates a string indicating the number of MHz of a value. For example,
+ * 2700000 produces "2.7".
+ * @buf: Buffer to hold output string, which must be large enough
+ * @hz: Value to convert
+ */
+char *strmhz(char *buf, unsigned long hz);
 #endif
diff --git a/lib/Makefile b/lib/Makefile
index 2fffd68f943..a0ac3f8b9bb 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -109,12 +109,12 @@ ifeq ($(CONFIG_$(SPL_TPL_)BUILD),y)
 ifdef CONFIG_USE_TINY_PRINTF
 obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += tiny-printf.o
 else
-obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += vsprintf.o strmhz.o
+obj-$(CONFIG_$(SPL_TPL_)SPRINTF) += vsprintf.o
 endif
 obj-$(CONFIG_$(SPL_TPL_)STRTO) += strto.o
 else
 # Main U-Boot always uses the full printf support
-obj-y += vsprintf.o strto.o strmhz.o
+obj-y += vsprintf.o strto.o
 endif
 
 subdir-ccflags-$(CONFIG_CC_OPTIMIZE_LIBS_FOR_SPEED) += -O2
diff --git a/lib/strmhz.c b/lib/strmhz.c
deleted file mode 100644
index 66afe91ab99..00000000000
--- a/lib/strmhz.c
+++ /dev/null
@@ -1,21 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0+
-/*
- * (C) Copyright 2002-2006
- * Wolfgang Denk, DENX Software Engineering, wd at denx.de.
- */
-#include <common.h>
-
-char *strmhz (char *buf, unsigned long hz)
-{
-	long l, n;
-	long m;
-
-	n = DIV_ROUND_CLOSEST(hz, 1000) / 1000L;
-	l = sprintf (buf, "%ld", n);
-
-	hz -= n * 1000000L;
-	m = DIV_ROUND_CLOSEST(hz, 1000L);
-	if (m != 0)
-		sprintf (buf + l, ".%03ld", m);
-	return (buf);
-}
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 425f2f53f79..a03a076a0aa 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -17,6 +17,7 @@
 #include <div64.h>
 #include <hexdump.h>
 #include <stdarg.h>
+#include <vsprintf.h>
 #include <linux/ctype.h>
 #include <linux/err.h>
 #include <linux/types.h>
@@ -873,3 +874,19 @@ bool str2long(const char *p, ulong *num)
 	*num = simple_strtoul(p, &endptr, 16);
 	return *p != '\0' && *endptr == '\0';
 }
+
+char *strmhz(char *buf, unsigned long hz)
+{
+	long l, n;
+	long m;
+
+	n = DIV_ROUND_CLOSEST(hz, 1000) / 1000L;
+	l = sprintf(buf, "%ld", n);
+
+	hz -= n * 1000000L;
+	m = DIV_ROUND_CLOSEST(hz, 1000L);
+	if (m != 0)
+		sprintf(buf + l, ".%03ld", m);
+
+	return buf;
+}
-- 
2.23.0.444.g18eeb5a265-goog



More information about the U-Boot mailing list