]> git.baikalelectronics.ru Git - uboot.git/commit
lib: div64: Add support for round up of div64_u64
authorAshok Reddy Soma <ashok.reddy.soma@xilinx.com>
Wed, 23 Feb 2022 14:36:04 +0000 (15:36 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 9 Mar 2022 11:34:47 +0000 (12:34 +0100)
commit1420a79177c7df61bba749b1acbda3d63399bb28
treea12270522aedb359a68edcd28060503190481b3b
parent96ec479825e491d2159dd264383a58ef8c02e54e
lib: div64: Add support for round up of div64_u64

Most of the frequencies are not rounded up to a proper number.
When we need to devide these frequencies to get a number for example
frequency in Mhz, we see it as one less than the actual intended value.
Ex: If we want to get Mhz from frequency 199999994hz, we will calculate
it using div64_u64(1999999941000000) and we will get 199Mhz in place
of 200Mhz.

Add a macro DIV64_U64_ROUND_UP for rounding up div64_u64. This is taken
from linux 'commit 68600f623d69("mm: don't miss the last page because of
round-off error")'.

Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Link: https://lore.kernel.org/r/f9fdcba76cd692ae436b1d7883b490e3dc207231.1645626962.git.michal.simek@xilinx.com
include/linux/math64.h