Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Romain TISSERAND <romain.tisserand@gmail.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: Chen-Yu Tsai <wens@kernel.org>,
	Jernej Skrabec <jernej.skrabec@gmail.com>,
	Samuel Holland <samuel@sholland.org>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Maxime Ripard <mripard@kernel.org>,
	Frank Oltmanns <frank@oltmanns.dev>,
	linux-clk@vger.kernel.org, linux-sunxi@lists.linux.dev,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: sunxi-ng: nkm: use div64_ul() for the rate divisions
Date: Thu,  3 Dec 2026 08:36:45 +0100	[thread overview]
Message-ID: <20261203073646.3099665-1-romain.tisserand@gmail.com> (raw)
In-Reply-To: <20261202224025.07df2dd1@pumpkin>

Hi David,

On Wed, 2 Dec 2026 22:40:25 +0000, David Laight wrote:
> Exactly when does the truncation happen?
> That is what actual values cause a truncation?

None. Every NKM clock in sunxi-ng has N <= 32, K <= 4 and M <= 16, so
n * k <= 128 and m <= 16: the divisor always fits in 32 bits and
do_div() gives the exact result today.

> And if there is one, why does it only happen on 64bit.

Only in the sense that the divisor is an unsigned long: on 64-bit it is
64 bits wide and do_div() takes a u32, so the conversion could in
theory drop high bits; on 32-bit unsigned long is already 32 bits, so
there is nothing to drop. With the real factor ranges it never happens
on either.

So "on 64-bit it would be truncated" overstates it, sorry for the
misleading wording and for the Fixes: tag: there is no bug to fix. The
patch only quiets the coccinelle do_div() check the robot reported,
with no functional change. If the maintainers want it, I will send a v2
whose commit message says just that, without the Fixes: tag; otherwise
it can simply be dropped.

Thanks,
Romain


  reply	other threads:[~2026-12-03  7:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 16:22 [PATCH] clk: sunxi-ng: nkm: use div64_ul() for the rate divisions Romain TISSERAND
2026-12-02 21:40 ` Romain TISSERAND
2026-12-02 22:40 ` David Laight
2026-12-03  7:36   ` Romain TISSERAND [this message]
2026-12-03  9:15     ` David Laight

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261203073646.3099665-1-romain.tisserand@gmail.com \
    --to=romain.tisserand@gmail.com \
    --cc=bmasney+clk@redhat.com \
    --cc=david.laight.linux@gmail.com \
    --cc=frank@oltmanns.dev \
    --cc=jbrunet+clk@baylibre.com \
    --cc=jernej.skrabec@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@lists.linux.dev \
    --cc=mripard@kernel.org \
    --cc=samuel@sholland.org \
    --cc=sboyd@kernel.org \
    --cc=wens@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox