Re: [PATCH v9 5/6] iio: adc: ltc2378: Add support for LTC2338-18
Jonathan Cameron <[email protected]>
| Newsgroups | org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <20260812050300.02ba78a6@jic23-huawei> |
On Tue, 11 Aug 2026 11:56:27 +0300 Andy Shevchenko <[email protected]> wrote: > 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? Patch on top. Pull request went out. I was busy with some other stuff so didn't get a chance to catch up with outstanding discussion before sending that. Jonathan >