Re: [PATCH v9 5/6] iio: adc: ltc2378: Add support for LTC2338-18

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.