lib: print_freq() should output kHz not KHz
cover lib: print_freq() should output kHz not KHz
Correct print_freq() for output of kHz. Provide unit tests for print_freq() and print_size().
Heinrich Schuchardt (2):
lib: print_freq() should output kHz not KHz
test: unit tests for print_freq(), print_size()
include/display_options.h | 2 +- lib/display_options.c | 2 +- test/lib/Makefile | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
--
2.28.0
PATCH 1/2 lib: print_freq() should output kHz not KHz
In the International System of Units (SI) the prefix kilo is abbreviated as 'k' not 'K'. 'K' is the symbol for Kelvin.
--- include/display_options.h | 2 +- lib/display_options.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
include/display_options.h +1 -1
@@ -24,7 +24,7 @@ void print_size(uint64_t size, const char *suffix);/** * print_freq() - Print a frequency with a suffix * -* Print frequencies as "x.xx GHz", "xxx KHz", etc as needed; allow for +* Print frequencies as "x.xx GHz", "xxx kHz", etc as needed; allow for * optional trailing string (like "\n") * * @freq: Frequency to print in Hz
lib/display_options.c +1 -1
@@ -54,7 +54,7 @@ void print_freq(uint64_t freq, const char *s) {unsigned long m =0 ;uint32_t f; -static const char names[] = {'G' ,'M' ,'K' }; +static const char names[] = {'G' ,'M' ,'k' };unsigned long d =1e9 ;char c =0 ;unsigned int i;
--
2.28.0
PATCH 1/2 lib: print_freq() should output kHz not KHz
Quoted 4 lines · Heinrich Schuchardt
In the International System of Units (SI) the prefix kilo is abbreviated as 'k' not 'K'. 'K' is the symbol for Kelvin.
Signed-off-by Heinrich Schuchardt <[email protected]>
Thanks,
Stefan
Quoted 32 lines
--- include/display_options.h | 2 +- lib/display_options.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)include/display_options.h +1
-1@@ -24,7 +24,7 @@ void print_size(uint64_t size, const char *suffix);/** * print_freq() - Print a frequency with a suffix * -* Print frequencies as "x.xx GHz", "xxx KHz", etc as needed; allow for +* Print frequencies as "x.xx GHz", "xxx kHz", etc as needed; allow for * optional trailing string (like "\n") * * @freq: Frequency to print in Hz lib/display_options.c +1
-2@@ -54,7 +54,7 @@ void print_freq(uint64_t freq, const char *s) {unsigned long m =0 ;uint32_t f; -static const char names[] = {'G' ,'M' ,'K' }; +static const char names[] = {'G' ,'M' ,'k' };unsigned long d =1e9 ;char c =0 ;unsigned int i; --
Quoted 2 lines
2.28.0
Viele Gr??e,
Stefan
Signature · 3 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr at denx.de
PATCH 1/2 lib: print_freq() should output kHz not KHz
In reply to Heinrich SchuchardtQuoted 5 lines · Heinrich Schuchardt
In the International System of Units (SI) the prefix kilo is abbreviated as 'k' not 'K'. 'K' is the symbol for Kelvin.
Signed-off-by Heinrich Schuchardt <[email protected]>Reviewed-by Stefan Roese <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201022/7c67791a/attachment.sig>
PATCH 2/2 test: unit tests for print_freq(), print_size()
In reply to Heinrich SchuchardtProvide unit tests for functions print_freq() and print_size().
--- test/lib/Makefile | 1 + 1 file changed, 1 insertion(+)
test/lib/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_EFI_LOADER) += efi_device_path.o obj-$(CONFIG_EFI_SECURE_BOOT) += efi_image_region.o obj-y += hexdump.o obj-y += lmb.o +obj-y += test_print.o obj-$(CONFIG_SSCANF) += sscanf.o obj-y += string.o obj-$(CONFIG_ERRNO_STR) += test_errno_str.o
--
2.28.0
PATCH 2/2 test: unit tests for print_freq(), print_size()
Quoted 12 lines · Heinrich Schuchardt
Provide unit tests for functions
print_freq()andprint_size().Signed-off-by Heinrich Schuchardt <[email protected]>--- test/lib/Makefile | 1 + 1 file changed, 1 insertion(+)test/lib/Makefile +0
-0
test/lib/Makefile obj-$(CONFIG_EFI_LOADER) += efi_device_path.o · line 10
Quoted 4 lines
test/lib/Makefile +1
-0@@ -7,6 +7,7 @@ obj-$(CONFIG_EFI_LOADER) += efi_device_path.o obj-$(CONFIG_EFI_SECURE_BOOT) += efi_image_region.o obj-y += hexdump.o obj-y += lmb.o +obj-y += test_print.o
Should test/lib/test_print.c be included in this patch?
--Sean
Quoted 6 lines
test/lib/Makefile +0
-1obj-$(CONFIG_SSCANF) += sscanf.o obj-y += string.o obj-$(CONFIG_ERRNO_STR) += test_errno_str.o --2.28.0
PATCH 2/2 test: unit tests for print_freq(), print_size()
In reply to Heinrich SchuchardtQuoted 16 lines · Heinrich Schuchardt
Provide unit tests for functions
print_freq()andprint_size().Signed-off-by Heinrich Schuchardt <[email protected]>--- test/lib/Makefile | 1 + 1 file changed, 1 insertion(+)--
2.28.0test/lib/Makefile +0
-0
test/lib/Makefile obj-$(CONFIG_EFI_LOADER) += efi_device_path.o · line 13
Quoted 7 lines
test/lib/Makefile +1
-0@@ -7,6 +7,7 @@ obj-$(CONFIG_EFI_LOADER) += efi_device_path.o obj-$(CONFIG_EFI_SECURE_BOOT) += efi_image_region.o obj-y += hexdump.o obj-y += lmb.o +obj-y += test_print.o obj-$(CONFIG_SSCANF) += sscanf.o obj-y += string.o obj-$(CONFIG_ERRNO_STR) += test_errno_str.o
New test file missing.
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 659 bytes Desc: not available URL: <https://lists.denx.de/pipermail/u-boot/attachments/20201022/e8c99ff2/attachment.sig>