From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Janani Sunil <janani.sunil@analog.com>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
"Michael Hennerich" <Michael.Hennerich@analog.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Philipp Zabel" <p.zabel@pengutronix.de>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Mark Brown" <broonie@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
"Janani Sunil" <jan.sun97@gmail.com>,
linux-spi@vger.kernel.org
Subject: Re: [PATCH v5 3/3] iio: dac: Add AD5529R DAC driver support
Date: Wed, 1 Jul 2026 12:17:44 +0300 [thread overview]
Message-ID: <akTbODssLM4UViF9@ashevche-desk.local> (raw)
In-Reply-To: <20260701-ad5529r-driver-v5-3-ed087900e642@analog.com>
On Wed, Jul 01, 2026 at 08:40:41AM +0200, Janani Sunil wrote:
> Add support for AD5529R 16-channel, 12/16 bit Digital to Analog Converter
> from Analog Devices.
>
> The device communicates over SPI and supports per-channel output range
> configuration. An optional external 4.096V reference can be used in
> place of the internal reference.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
A couple of nit-picks below.
...
> +static int ad5529r_find_output_range(const s32 *vals)
> +{
> + for (unsigned int i = 0; i < ARRAY_SIZE(ad5529r_output_ranges_mV); i++) {
> + if (vals[0] == ad5529r_output_ranges_mV[i][0] * 1000 &&
> + vals[1] == ad5529r_output_ranges_mV[i][1] * 1000)
So, the correct way is to have either defined constant in units.h or while now
(MICRO / MILLI). So, with a temporary pointer this can be achieved without
uglifying the code
... *range = &ad5529r_output_ranges_mV[i];
if (vals[0] == range[0] * (MICRO / MILLI) &&
vals[1] == range[1] * (MICRO / MILLI))
> + return i;
> + }
> +
> + return -EINVAL;
> +}
...
> + /*
> + * The datasheet mentions a 4.096V external reference for correct
> + * operation.
> + */
> + ret = devm_regulator_get_enable_optional(dev, "vref");
> + if (ret == -ENODEV) {
> + external_vref = false;
> + } else if (ret) {
> + return dev_err_probe(dev, ret,
> + "Failed to get and enable vref regulator\n");
> + } else {
> + external_vref = true;
> + }
All branches are single statement. No {} are needed.
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2026-07-01 9:17 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 6:40 [PATCH v5 0/3] iio: dac: Add support for AD5529R DAC Janani Sunil
2026-07-01 6:40 ` [PATCH v5 1/3] dt-bindings: spi: Add spi,device-addr peripheral property Janani Sunil
2026-07-01 6:52 ` sashiko-bot
2026-07-01 11:04 ` Conor Dooley
2026-07-01 18:29 ` Jonathan Cameron
2026-07-01 18:48 ` David Lechner
2026-07-01 20:31 ` Conor Dooley
2026-07-01 6:40 ` [PATCH v5 2/3] dt-bindings: iio: dac: Add AD5529R Janani Sunil
2026-07-01 6:52 ` sashiko-bot
2026-07-01 11:07 ` Conor Dooley
2026-07-01 18:41 ` Jonathan Cameron
2026-07-03 10:01 ` Janani Sunil
2026-07-03 15:02 ` David Lechner
2026-07-01 6:40 ` [PATCH v5 3/3] iio: dac: Add AD5529R DAC driver support Janani Sunil
2026-07-01 6:52 ` sashiko-bot
2026-07-01 9:17 ` Andy Shevchenko [this message]
2026-07-01 18:55 ` 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=akTbODssLM4UViF9@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=broonie@kernel.org \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jan.sun97@gmail.com \
--cc=janani.sunil@analog.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=p.zabel@pengutronix.de \
--cc=robh@kernel.org \
--cc=skhan@linuxfoundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.