Devicetree
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Marcelo Schmitt <marcelo.schmitt1@gmail.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: Tue, 11 Aug 2026 11:56:27 +0300	[thread overview]
Message-ID: <anrju2FHVOfS-e6z@ashevche-desk.local> (raw)
In-Reply-To: <anqM43NvcVhhkkWI@debian-BULLSEYE-live-builder-AMD64>

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



  reply	other threads:[~2026-08-11  8:56 UTC|newest]

Thread overview: 16+ 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
2026-08-11  8:56       ` Andy Shevchenko [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=anrju2FHVOfS-e6z@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