Re: [PATCH 4/5] lib: div64: sync with Linux v7.1

Simon Glass <[email protected]>
Newsgroups org.u-boot-project.lists.u-boot
Message-ID <CAFLszTjtp1ef6RS3BBgJR=U=AEcRdELchZMaZFgWP9S1eHdktQ@mail.gmail.com>
On 2026-07-30T18:40:37, Alexey Charkov <[email protected]> wrote:
> lib: div64: sync with Linux v7.1
>
> Bring the structure of this file in line with Linux v7.1
> lib/math/div64.c, so that future resyncs are a near-verbatim diff. No
> functional change: the compiled lib/div64.o is byte-identical before and
> after, verified by comparing objdump -d output for both
> evb-rk3288-rk808_defconfig (32-bit, where these out-of-line helpers are
> actually built) and generic-rk3576_defconfig (64-bit).
>
>  - Add the SPDX license identifier, as upstream did in commit
>    b24413180f56 ("License cleanup: add SPDX GPL-2.0 license identifier
>    to files with no license").
>
>  - Demote the kernel-doc blocks on div64_u64_rem() and div64_u64() to
>    plain comments and drop the one on div64_s64() entirely, following
>    upstream commit d28a1de5d112 ("math64: favor kernel-doc from header
>    files"). The kernel-doc for these lands in <linux/math64.h> in a
>    later patch of this series; keeping it in both places would only let
>    the two copies drift apart.
>
>  - Guard iter_div_u64_rem() with #ifndef iter_div_u64_rem, matching
>    upstream, so an arch can override it the same way it can override
>    the other helpers here.
>
> Two U-Boot-local deviations are kept deliberately and are now marked as
> such so that the next resync does not silently drop them:
>
>  - __div64_32() carries a no_instrument_function attribute, needed
>    because CONFIG_TRACE builds with -finstrument-functions and this
>    function is reachable from tracing code via do_div().
>
>  - The includes stay as they are. <linux/compat.h> provides U-Boot's
>    no-op EXPORT_SYMBOL() in place of upstream's <linux/export.h>, and
>    <linux/kernel.h> provides abs()/abs64() in place of upstream's
>    <linux/math.h>, which U-Boot does not have.
>
> The u32/u64 spelling is also left alone rather than converted to Linux's
> uint32_t/uint64_t: U-Boot's <div64.h> already made the opposite choice,
> and matching Linux here would make the two files inconsistent for no
> benefit.
>
> Signed-off-by: Alexey Charkov <[email protected]>
>
> lib/div64.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)

Reviewed-by: Simon Glass <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.