Re: [PATCH v7 2/2] iio: dac: ad5706r: Add support for AD5706R DAC

From: Andy Shevchenko

Date: Wed Apr 15 2026 - 00:53:03 EST


On Wed, Apr 15, 2026 at 01:10:09AM +0000, Torreno, Alexis Czezar wrote:

...

> > > + case IIO_CHAN_INFO_RAW:
> > > + if (!in_range(val, 0, AD5706R_DAC_MAX_CODE))
> >
> > I'm not seeing a strong reason to use in_range() here (hopefully I didn't
> > suggest it in an earlier review ;) It make sense when we have a val >= base &&
> > val < base + length. With base as 0 and MAX_CODE not 'obviously' from it's
> > name being the length (it only is becauset he base is 0) this seems odd.
> >
> > if (val < 0 || val >= AD5706R_DAC_MAX_CODE) Though see
> > above on MAX_CODE not being the maximum code...
>
> I think around v3 Andy suggested the use of in_range, as the function itself helps
> document what the line does. Is this a style preference?

I believe it was me, who suggested that, but we can open code it. Indeed, it's
just a style preference in this case.

--
With Best Regards,
Andy Shevchenko