Re: [PATCH v9 5/6] iio: adc: ltc2378: Add support for LTC2338-18
From: Andy Shevchenko
Date: Tue Aug 11 2026 - 05:03:03 EST
On Mon, Aug 10, 2026 at 11:45:55PM -0300, Marcelo Schmitt wrote:
...
> > > + /*
> > > + * The internal reference buffer amplifies both the internal reference
> > > + * and REFIN by a factor of 2.
> > > + */
> > > + ret = devm_regulator_get_enable_read_voltage(dev, "refin");
> > > + if (ret == -ENODEV) { /* refin is optional */
> > > + st->ref_uV = st->info->internal_ref_uV * 2;
> > > + return 0;
> > > + }
> > > +
> > > + if (ret < 0)
> > > + return dev_err_probe(dev, ret, "failed to read refin regulator\n");
> > > +
> > > + st->ref_uV = ret * 2;
> > > +
> > > + return 0;
> >
> > I'm not sure about others' preferences, but I would do it as if-else-if and
> > remove dup return 0.
> >
> > if (ret == -ENODEV) /* refin is optional */
> > st->ref_uV = st->info->internal_ref_uV * 2;
> > else if (ret < 0)
> > return dev_err_probe(dev, ret, "failed to read refin regulator\n");
> > else
> > st->ref_uV = ret * 2;
> >
> > return 0;
> >
> > It also makes code shorter (in amount of LoC).
>
> This has already been applied to IIO testing. I do send another version of this
> specific patch if that's okay.
Jonathan can replace it there, as rebase is inevitable anyway. Let's ask his
opinion: Jonathan, do you want a followup that can be folded or a new version
of this patch?
--
With Best Regards,
Andy Shevchenko