Re: [PATCH] iio: dac: max5522: use devm_regulator_get_enable_read_voltage()

Jonathan Cameron
2026-02-14T18:21:00Z

On Tue, 10 Feb 2026 21:35:26 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Tue, Feb 10, 2026 at 07:51:27PM +0200, Antoniu Miclaus wrote:
> > Simplify probe by using devm_regulator_get_enable_read_voltage() to
> > get, enable and read the regulator voltage in a single call, caching
> > the value at probe time.
>
> ...
>
> > - struct regulator *vrefin_reg;
> > + unsigned short vref_mv;
>
> vref_mV ?
>
> ...
>
> > + state->vref_mv = ret / 1000;
>
> "1000" --> "(MICRO / MILLI)" ?
> (yes, this way with the parentheses).

I know I've argued against proliferation of the X_PER_Y macros
but this one does seem to be very common. Maybe it's time to bring in

MICROVOLTS_PER_MILLIVOLT even if it's longer than the open coded version?

Andy, what do you think? I do worry that people will see it as fine
to add many many others if we start with this one though. So maybe not.

Anyhow, doesn't need to be in this series.

Jonathan

>