lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VeuA-Wvs9o9cXBFxL6D90mvN9eQA=tOtxB2GT7sPSqw9w@mail.gmail.com>
Date: Wed, 10 Dec 2025 13:13:08 +0200
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Kurt Borja <kuurtb@...il.com>
Cc: Jonathan Cameron <jic23@...nel.org>, Rob Herring <robh@...nel.org>, 
	Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, 
	Tobias Sperling <tobias.sperling@...ting.com>, David Lechner <dlechner@...libre.com>, 
	Nuno Sá <nuno.sa@...log.com>, 
	Andy Shevchenko <andy@...nel.org>, linux-iio@...r.kernel.org, devicetree@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Jonathan Cameron <Jonathan.Cameron@...wei.com>
Subject: Re: [PATCH v7 2/2] iio: adc: Add ti-ads1018 driver

On Wed, Dec 10, 2025 at 6:07 AM Kurt Borja <kuurtb@...il.com> wrote:
> On Mon Dec 8, 2025 at 3:19 PM -05, Andy Shevchenko wrote:

...

> >> +       /* ...Then calculate time per sample in microseconds. */
> >> +       return DIV_ROUND_UP(MICROHZ_PER_HZ, hz);
> >
> > If time per sample is in µs, the associated frequency is in MHz, so
> > the correct constant is HZ_PER_MHZ. What did I miss here?
>
> I was very confused about this, but the dimensional analysis works with
> HZ_PER_MHZ so it should be the right constant. Thanks!

You need to keep in mind the sign of the order of magnitude. Since we
don't use floats in the kernel, the small units are represented as
divisors in opposite to multipliers. So, the used one is 10⁻⁶, while
the proposed one is 10⁶.

...

> Do you have a suggestion for this? I can keep the ADS1018_FSR_TO_SCALE()
> macro but it will get a bit more complex or I can just hard code the
> scales and document the calculation. I'm inclined to do the latter.

I believe we will see based on your next version. Just avoid hard
coding magic numbers, and put more comments, ideally with the
references to a datasheet section.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ