[U-Boot] [PATCH] improved strmhz()

Kumar Gala galak at kernel.crashing.org
Tue Oct 21 18:54:35 CEST 2008


>>
> That looks overly complex to me. Can you please check if this patch
> fixes the problem for your test cases, too:
>
>> From 963e7db81379225b78bfac0d7457300c86d6b4d6 Mon Sep 17 00:00:00  
>> 2001
> From: Wolfgang Denk <wd at denx.de>
> Date: Tue, 21 Oct 2008 15:53:51 +0200
> Subject: [PATCH] Fix strmhz(): avoid printing negative fractions
>
> Signed-off-by: Wolfgang Denk <wd at denx.de>
> ---
> lib_generic/strmhz.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/lib_generic/strmhz.c b/lib_generic/strmhz.c
> index 342cf2b..d6da1d1 100644
> --- a/lib_generic/strmhz.c
> +++ b/lib_generic/strmhz.c
> @@ -27,7 +27,7 @@ char *strmhz (char *buf, long hz)
> 	long l, n;
> 	long m;
>
> -	n = DIV_ROUND(hz, 1000000L);
> +	n = DIV_ROUND(hz, 1000) / 1000L;
> 	l = sprintf (buf, "%ld", n);
>
> 	hz -= n * 1000000L;
> -- 
> 1.5.5.1

I haven't been following this thread, but can we control the number of  
significant digits.  I'm starting to see output like:

Clock Configuration:
        CPU:1500.4294967282 MHz, CCB:600.4294967291 MHz,
        DDR:400.4294967293 MHz (800.4294967289 MT/s data rate)  
(Asynchronous), LBC:37.500 MHz

(it use to look like)

Clock Configuration:
        CPU:1500 MHz, CCB: 600 MHz,
        DDR: 401 MHz (801 MT/s data rate) (Asynchronous), LBC:  37 MHz

- k


More information about the U-Boot mailing list