From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Kurt Borja <kuurtb@gmail.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Tobias Sperling" <tobias.sperling@softing.com>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
"Jonathan Cameron" <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v2 2/2] iio: adc: Add ti-ads1018 driver
Date: Fri, 28 Nov 2025 12:21:24 +0200 [thread overview]
Message-ID: <aSl3pFfXhNVFbjxX@smile.fi.intel.com> (raw)
In-Reply-To: <aSlxSj7XEq7PUxsk@smile.fi.intel.com>
On Fri, Nov 28, 2025 at 11:54:18AM +0200, Andy Shevchenko wrote:
> On Thu, Nov 27, 2025 at 10:37:11PM -0500, Kurt Borja wrote:
...
> for (unsigned int i = 0; i < info->num_pga_mode_to_gain; i++) {
> if (val == info->pga_mode_to_gain[i][0] ||
> val2 == info->pga_mode_to_gain[i][1])
> break;
> }
> if (i == info->num_pga_mode_to_gain)
> return -EINVAL;
>
> ads1018_set_pga_mode(ads1018, chan->scan_index, i);
> return 0;
>
> This also will follow the traditional pattern: Check for the error cases first.
Just noticed that in this case the scope of iterator should be out of the loop.
Since you have it used more than once, move it to the top of the function.
> > + case IIO_CHAN_INFO_SAMP_FREQ:
> > + for (int i = 0; i < info->num_data_rate_mode_to_hz; i++) {
>
> Ditto, same comments as per previous loop.
>
> > + if (val != info->data_rate_mode_to_hz[i])
> > + continue;
> > +
> > + ads1018_set_data_rate_mode(ads1018, chan->scan_index, i);
> > + return 0;
> > + }
> > +
> > + return -EINVAL;
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2025-11-28 10:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 3:37 [PATCH v2 0/2] iio: Add support for TI ADS1X18 ADCs Kurt Borja
2025-11-28 3:37 ` [PATCH v2 1/2] dt-bindings: iio: adc: Add TI ADS1018/ADS1118 Kurt Borja
2025-11-28 9:43 ` Krzysztof Kozlowski
2025-11-28 17:40 ` Kurt Borja
2025-11-28 3:37 ` [PATCH v2 2/2] iio: adc: Add ti-ads1018 driver Kurt Borja
2025-11-28 9:54 ` Andy Shevchenko
2025-11-28 10:21 ` Andy Shevchenko [this message]
2025-11-28 17:38 ` Kurt Borja
2025-11-28 19:02 ` Andy Shevchenko
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=aSl3pFfXhNVFbjxX@smile.fi.intel.com \
--to=andriy.shevchenko@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=kuurtb@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=tobias.sperling@softing.com \
/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