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

Jonathan Cameron
2026-02-15T16:00:47Z

On Sun, 15 Feb 2026 09:53:08 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Sat, Feb 14, 2026 at 12:36:12PM -0600, David Lechner wrote:
> > On 2/14/26 12:31 PM, Andy Shevchenko wrote:
> > > On Sat, Feb 14, 2026 at 06:20:52PM +0000, Jonathan Cameron wrote:
> > >> 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:
>
> ...
>
> > >>>> + 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.
> > >
> > > IIRC (sorry, if I am wrong) it was you who objected in the first place
> > > and I proposed that from day 1 discussing the "(MICRO / MILLI)" approach
> > > a year (?) or so ago. Answering to the Q: I am in favour of having that
> > > definition.

Yup. I got convinced over time! I still a little doubtful but
seemed like it was worth revisiting the question.

> > >
> > >> Anyhow, doesn't need to be in this series.
> > >
> > > True.
> >
> > How about MICRO_PER_MILLI? Then we won't have to add a new one
> > for every different type of unit.

I think it only commonly occurs for voltage because of the whole
mismatch between the regulators framework and both IIO and HWMON
in units. That's based on gut feel though rather actually checking
the code.

Jonathan

>
> Dunno, as a physicist, I prefer the way with units.
>