Re: [PATCH v2] staging: iio: impedance-analyzer: ad5933: use div64_ul() instead of do_div()
From: Andy Shevchenko
Date: Wed Feb 18 2026 - 08:51:23 EST
On Wed, Feb 18, 2026 at 06:23:27PM +0530, Archit Anant wrote:
> Replace do_div() with div64_ul() since the remainder is not used.
> div64_ul() is the preferred API for 64-bit by 32-bit division when
> only the quotient is needed.
>
> Also replace explicit casting and shifting with the BIT_ULL(27) macro
> for clarity.
>
> Note: A mathematical simplification to `(freq * BIT_ULL(29)) / mclk` was
> suggested during review to improve precision. However, as confirmed by
> maintainers, the original driver's truncation via `(mclk / 4)` might
> be intentional or relied upon by userspace. Since hardware is not
> available for verification, this patch preserves the original logic
> to avoid regression risk in the absence of testing.
>
> Issue identified by coccicheck using do_div.cocci.
> Changes in v2:
> - Replaced explicit `(u64)(1 << 27)` with `BIT_ULL(27)` as suggested by Andy Shevchenko.
> - Kept original arithmetic logic `(mclk / 4)` to preserve behavior.
The place for changelog (and comments)...
> Signed-off-by: Archit Anant <architanant5@xxxxxxxxx>
> ---
...is here.
But do not resend until maintainers explicitly ask for that.
--
With Best Regards,
Andy Shevchenko