Re: [PATCH v3 3/5] iio: amplifiers: ada4250: use devm_regulator_get_enable_read_voltage()
From: Andy Shevchenko
Date: Thu Jun 12 2025 - 09:03:31 EST
On Wed, Jun 11, 2025 at 04:33:03PM -0500, David Lechner wrote:
> Use devm_regulator_get_enable_read_voltage() to simplify the code.
>
> Replace 1000000 with MICRO while we are touching this for better
> readability.
...
> - voltage_v = DIV_ROUND_CLOSEST(voltage_v, 1000000);
> + voltage_v = DIV_ROUND_CLOSEST(st->avdd_uv, MICRO);
Side note. I'm always worry about CLOSEST choice when it's related to voltage
or current. Imagine the table which gives you 5, 3.3, and 1.2. If it happens to
be closest to higher value, it may damage HW forever.
--
With Best Regards,
Andy Shevchenko