Re: [PATCH] iio: common: scmi_sensors: fix truncating 64-bit divisions

From: Arnav Kapoor

Date: Sun Oct 04 2026 - 06:43:58 EST


On Sat, Oct 03, 2026, Andy Shevchenko wrote:
> On Sat, Oct 03, 2026 at 11:25:55AM +0530, Arnav Kapoor wrote:
> > Assisted-by: Claude:claude-opus-5-5 coccinelle
>
> Assisted-by: LLM coccinelle

Right, I missed that the documented format had changed. Fixed in v2.

> > + time_ns = div64_u64(time,
> > + int_pow(10, abs(tstamp_scale)));
>
> It's fine to have 82 character single line in this case.

Will do.

> > + *hz = div64_u64_rem(NSEC_PER_SEC, interval_ns, &rem);
>
> I would expect to see this be a frequency unit to help with left side of the
> equation
>
> *hz = div64_u64_rem(HZ_PER_GHZ, interval_ns, &rem);
>
> > + *uhz = div64_u64(rem * 1000000UL, interval_ns);
>
> And MICROHZ_PER_HZ here respectively.

Makes sense, I'll use both in v2.

Thanks for the review!

Arnav