From: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: Marcelo Schmitt <marcelo.schmitt@analog.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, jic23@kernel.org,
nuno.sa@analog.com, Michael.Hennerich@analog.com,
dlechner@baylibre.com, andy@kernel.org, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, julianbraha@gmail.com
Subject: Re: [PATCH v9 5/6] iio: adc: ltc2378: Add support for LTC2338-18
Date: Mon, 10 Aug 2026 23:45:55 -0300 [thread overview]
Message-ID: <anqM43NvcVhhkkWI@debian-BULLSEYE-live-builder-AMD64> (raw)
In-Reply-To: <anl_v428aTL6waBK@ashevche-desk.local>
Hi Andy,
On 08/10, Andy Shevchenko wrote:
> On Mon, Jul 27, 2026 at 06:31:58PM -0300, Marcelo Schmitt wrote:
> > LTC2338-18 is similar to LTC2378-18, differentiating from the already
> > supported part mainly on the embedment of an internal voltage reference and
> > addition of a resistor divider network connected to the input signal path.
> > Extend the device driver, handling the internal reference and input signal
> > attenuation, enabling it to also support LTC2338-18.
>
> ...
>
> > +static int ltc2378_refin_setup(struct device *dev, struct ltc2378_state *st)
> > +{
> > + int ret;
> > +
> > + /*
> > + * 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.
With Best Regards,
Marcelo
next prev parent reply other threads:[~2026-08-11 2:45 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 21:30 [PATCH v9 0/6] iio: adc: Add support for LTC2378 and similar ADCs Marcelo Schmitt
2026-07-27 21:30 ` [PATCH v9 1/6] dt-bindings: iio: adc: Add ltc2378 Marcelo Schmitt
2026-07-27 21:30 ` [PATCH v9 2/6] iio: adc: ltc2378: Add support for LTC2378-20 and similar ADCs Marcelo Schmitt
2026-07-27 21:42 ` sashiko-bot
2026-07-28 13:06 ` Marcelo Schmitt
2026-07-27 21:31 ` [PATCH v9 3/6] iio: adc: ltc2378: Enable high-speed data capture Marcelo Schmitt
2026-07-27 21:49 ` sashiko-bot
2026-07-27 21:31 ` [PATCH v9 4/6] iio: adc: ltc2378: Enable triggered buffer " Marcelo Schmitt
2026-07-27 21:31 ` [PATCH v9 5/6] iio: adc: ltc2378: Add support for LTC2338-18 Marcelo Schmitt
2026-07-27 21:40 ` sashiko-bot
2026-07-28 13:12 ` Marcelo Schmitt
2026-08-01 21:12 ` Jonathan Cameron
2026-08-10 7:37 ` Andy Shevchenko
2026-08-11 2:45 ` Marcelo Schmitt [this message]
2026-07-27 21:32 ` [PATCH v9 6/6] iio: ABI: Encourage differential voltage ABI usage Marcelo Schmitt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=anqM43NvcVhhkkWI@debian-BULLSEYE-live-builder-AMD64 \
--to=marcelo.schmitt1@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=julianbraha@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=marcelo.schmitt@analog.com \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox