From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Marcelo Schmitt <marcelo.schmitt@analog.com>
Cc: 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,
marcelo.schmitt1@gmail.com
Subject: Re: [PATCH v9 5/6] iio: adc: ltc2378: Add support for LTC2338-18
Date: Mon, 10 Aug 2026 10:37:35 +0300 [thread overview]
Message-ID: <anl_v428aTL6waBK@ashevche-desk.local> (raw)
In-Reply-To: <39f2ff86cf736ff97286d6451fcc45fdba6732f9.1785186980.git.marcelo.schmitt@analog.com>
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).
> +}
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-08-10 7:37 UTC|newest]
Thread overview: 14+ 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:31 ` [PATCH v9 3/6] iio: adc: ltc2378: Enable high-speed data capture Marcelo Schmitt
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-08-10 7:37 ` Andy Shevchenko [this message]
2026-08-11 2:45 ` Marcelo Schmitt
2026-08-11 8:56 ` Andy Shevchenko
2026-08-12 4:03 ` Jonathan Cameron
2026-07-27 21:32 ` [PATCH v9 6/6] iio: ABI: Encourage differential voltage ABI usage Marcelo Schmitt
2026-08-12 4:01 ` Jonathan Cameron
2026-08-12 18:25 ` Marcelo Schmitt
2026-08-15 1:39 ` Jonathan Cameron
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=anl_v428aTL6waBK@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.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.schmitt1@gmail.com \
--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
all inboxes | Powered by JetHome®