[U-Boot-Users] [PATCH] 85xx: Round up frequency calculations to get reasonable output
Andy Fleming
afleming at gmail.com
Fri Apr 18 19:11:28 CEST 2008
On Fri, Apr 18, 2008 at 11:57 AM, Kumar Gala <galak at kernel.crashing.org> wrote:
> eg. because of rounding error we can get 799Mhz instead of 800Mhz.
>
> Signed-off-by: Dejan Minic <minic at freescale.com>
> Signed-off-by: Srikanth Srinivasan <srikanth.srinivasan at freescale.com>
> Signed-off-by: Kumar Gala <galak at kernel.crashing.org>
> ---
> cpu/mpc85xx/cpu.c | 18 +++++++++++-------
> 1 files changed, 11 insertions(+), 7 deletions(-)
>
> diff --git a/cpu/mpc85xx/cpu.c b/cpu/mpc85xx/cpu.c
> index dcd8817..6972bb1 100644
> --- a/cpu/mpc85xx/cpu.c
> +++ b/cpu/mpc85xx/cpu.c
> @@ -65,6 +65,11 @@ struct cpu_type cpu_type_list [] = {
> CPU_TYPE_ENTRY(8572_E),
> };
>
> +static inline unsigned long integer_round (unsigned long val, unsigned long div)
> +{
> + return ((val + (div/2)) / div);
> +}
> +
Ok, but I don't think we can really call it integer_round(). Can we
call it something that reflects what it does? Like, rounded_divide()
or something?
Andy
More information about the U-Boot
mailing list